This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing date in DB using Entity Beans

 
Diwakar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Iam struck with the following, please help me.
After accepting date from a JSP page in the form of String, I want it to be stored into the data-base using EntityBean. The corresponding fields in Oracle are DATE (sql data-type) and java.sql.Date in my CMP field.
Now the problem was do I convert the accepted date to java.sql.Date, which I did by using java.sql.Date.parse("accepted date from JSP"); But Iam getting exception when I try to insert it into the Data-base.
What is the solution to this problem?? Is there any other solution to "insert a into a Data-base using an entity-bean" ??
 
Marco Barenkamp
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

when Entity Beans deal with Date or Time values, they must be converted into
long values.
Additionally, finder or select methods cannot work with date objects either.
You have to use the appropriate long value instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic