-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate, Oracle DATE -> java.sql.Date, times cut out
PostPosted: Mon Oct 25, 2010 4:38 am 
Newbie

Joined: Fri Mar 19, 2010 12:29 pm
Posts: 12
Hello, I'm using hibernate 3.5 with Oracle 10g.

For creating object recived via sql requests I use AliasToBeanResultTransformer:
Code:
SQLQuery query = session.createSQLQuery(sql);
ResultTransformer tr = new AliasToBeanResultTransformer(SomeClass.class);           
query.setResultTransformer(tr);
List results = query.list();

Class SomeClass has no mappings

The problem is that in this case Oracle DATE type transformed to java.sql.Date. And times missed. (Despite in SomeClass corresponding fields declared as java.util.Date).

So is there possibility to setup hibernate that Oracle DATE converted to java.util.Date by default?


Top
 Profile  
 
 Post subject: Re: Hibernate, Oracle DATE -> java.sql.Date, times cut out
PostPosted: Wed Dec 22, 2010 8:37 pm 
Newbie

Joined: Wed Dec 22, 2010 8:32 pm
Posts: 1
java.sql.Date.valueOf("2010-12-30") will ensure hibernate save date correctly. Try avoid java.util.Date..with hibernate. Alternative: java.lang.String /java.sql.TimeStamp for date.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.