This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing date in DB using Entity Beans

 
Diwakar
Greenhorn
Posts: 9
  • 0
  • 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
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic