wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Date TimeStamp Issue" Watch "Date TimeStamp Issue" New topic

Date TimeStamp Issue

ashiwini jekan

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

Joined: Sep 13, 2007
Posts: 2247


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

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 9956

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

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

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.
wood burning stoves
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