Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to persiste a Date type

 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I have an Interface where you can choose day, month and year and then I{d like to save that on my class account expiration date where expiration date is a Java.util.Date.
Anybody can send me and example. I don't know hoe to convert an string to a Date that can be persisted by hibernate
King Regards
Naty
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at java.text.DateFormat. Particularly its parse method.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i use this utility class: (means Enter String output Date)

in my code i define:

and in my hbm.xml:

hope this helps
 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes It was great!
Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic