Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date TimeStamp Issue

 
ashiwini jekan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3444
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Have you checked your Oracle DB table definitions? Are the new and old tables the same?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic