• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inserting Java Date in MySQL as Datetime

 
Nicolás Muñoz
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am trying to insert a date from Java to a MySQL database (DATETIME) using Hibernate. Hibernate maps a Datetime as a java.util.Date but this class has many methods which have been deprecated. I don't know what I'm supposed to do. Thanks for any help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65217
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the problem? Just don't use the deprecated methods.
 
Nicolás Muñoz
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know I must not use them. I guess my real question is: what steps should I follow to correctly insert a Datetime in MySQL using Hibernate?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65217
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to be more specific as to what your problem is. The whole point of Hibernate is that you shouldn't need to worry about the details. Is your question that you are unsure how to go about mapping Date fields?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just because some methods are deprecated doesn't mean the *class* is deprecated.
 
ahmad seddighi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
take a look at http://www.xmission.com/~goodhill/dates/datedeprecation.htm
------------------------------------------------------------------------------------------------------------


Spring Persistence with Hibernate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic