aspose file tools*
The moose likes Object Relational Mapping and the fly likes Inserting Java Date in MySQL as Datetime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Inserting Java Date in MySQL as Datetime" Watch "Inserting Java Date in MySQL as Datetime" New topic
Author

Inserting Java Date in MySQL as Datetime

Nicolás Muñoz
Greenhorn

Joined: Nov 11, 2009
Posts: 17
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

Joined: Jan 10, 2002
Posts: 61648
    
  67

What's the problem? Just don't use the deprecated methods.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nicolás Muñoz
Greenhorn

Joined: Nov 11, 2009
Posts: 17
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

Joined: Jan 10, 2002
Posts: 61648
    
  67

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

Joined: Sep 29, 2008
Posts: 12617

Just because some methods are deprecated doesn't mean the *class* is deprecated.
ahmad seddighi
Greenhorn

Joined: Jun 22, 2004
Posts: 16
take a look at http://www.xmission.com/~goodhill/dates/datedeprecation.htm
------------------------------------------------------------------------------------------------------------


Spring Persistence with Hibernate
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Inserting Java Date in MySQL as Datetime