This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Date TimeStamp Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Date TimeStamp Issue" Watch "Date TimeStamp Issue" New topic
Author

Date TimeStamp Issue

ashiwini jekan
Greenhorn

Joined: Apr 30, 2012
Posts: 4
Well, we just recently migrated our project from WSAD 5.1 to RAD 8 . From Oracle 9i to 11g AND Java 1.4 to 1.6 AND Websphere App server 5.1 to 7. The project also implements Struts 1.1 and EJB 1 and 1.1 which have not been upgraded. Well after a lot of hurdles we finally got the application running but in the data colums in the database tables the timestamp is not getting inserted along with the date. this particular issue is seen only in ejb cmp managed beans not in the queries entered through simple jdbc.. First we thought it would be some mapping issue. but that doesnt seem to be the case. we applied the proper converters in the mappings. The data type of the columns in the table is DATE...

Earlier eveything was working correctly in the old env but here its not working in any of the tables
dont know what is the issue...

We thought of 2 solutions.
1) to make a code change but thought would be difficult because there are hundreds of ejb cmp beans

2) to create a trigger at db level during an insert query but this would cause a performance issue


Any suggestions for this issue would be really helpfull..

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2231
    
    7

Hello

Have you checked your Oracle DB table definitions? Are the new and old tables the same?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

Welcome to the forums!

ashiwini jekan wrote: but in the data colums in the database tables the timestamp is not getting inserted along with the date.



I haven't used EJB CMP, so can't say for sure what the spec says about this. But a Date type would be expected to just store the date (and not the timestamp) and that's what seems to be happening. You probably will have to map such CMP fields as TIMESTAMP type. Like I said, I haven't check the EJB CMP spec or the ejb-jar dtd for the allowed types. So check it first to see if it's allowed.
ashiwini jekan
Greenhorn

Joined: Apr 30, 2012
Posts: 4
First of all thanks for the reply.

I checked for the datatype in both of the old and new tables. Both have the datatype as DATE.

Secondly this is the conversion being applied in one of the generated stub files.



I remember such a conversion was implicitly handled in Websphere Server 5.1 but the same doesnt seems to be the case for Websphere Server 7. Hence i had to implement the conversion during the field mapping.

Not sure what else to look for
ashiwini jekan
Greenhorn

Joined: Apr 30, 2012
Posts: 4
the ibm converter was causing the timestamp values to be converted to date. The code below is at the stub level. In order to remove that i made the datatypes in the .dbm and bean field datatypes same and then mapped the fields.



That removed the converters in the generated stub. i dont know why there is such a behaviour but atleast it solved my problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date TimeStamp Issue
 
Similar Threads
f:convertDateTime and data type conversion
help needed with calling a stored procedure from CMP
Weblogic, CMP and O/R mapping tool?
Does �Hibernate� provide these features?
New Project EJB Vs Corba