Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Default date using CMP  RSS feed

 
Lalan Sarang
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After spending long time to make this work, i am lost. I have a date column in my table which defaults to sysdate. I am using CMP to persist. Is there ANY way i can achieve this. I want to read this date with my ejb to display into reports, but i want db to create it.
 
Susanta Chatterjee
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are couple of ways to do this:

1. You can use a trigger on the table, to insert SYSDATE just after inserting the row(It may not be considered to be a good practice, though).

2. Use Session Bean facade to get sysdate from database, using a JDBC call and set the property on the entity bean.

HTH/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!