-->
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.  [ 7 posts ] 
Author Message
 Post subject: I want to map sql datetime to java.util.Date in Hib-Consol
PostPosted: Fri Oct 06, 2006 3:52 am 
Beginner
Beginner

Joined: Tue Sep 19, 2006 5:46 am
Posts: 21
Location: india
hi all,

I want to map sql datetime to java.util.Date using hibernate tools i have put this <sql-type hibernate-type="java.util.Date" jdbc-type="DATE" /> entry in the reveng.xml. but still it is mapping to timestamp type. i tried with this
<sql-type hibernate-type="java.util.Date" jdbc-type="datetime" /> entry then it is showing an error. Can any body tell me which type has to be used to map sql datetime to java.util.Date

Thanks,
Joseph.C

_________________
JosephC


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 4:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what is the error ? something like jdbc-type not found in Types ? then either use a real name from java.sql.Types or use the numerical value returned for your db for such columns.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 5:15 am 
Beginner
Beginner

Joined: Tue Sep 19, 2006 5:46 am
Posts: 21
Location: india
<property name="createdOn" type="timestamp">
<column name="CREATED_ON" length="23" />

this is what is generated from the hibernate console. even if i gave the sql type as"DATE" .I am using ms-sql server.

OR

which template file should i modify to change the default from timestamp to java.utill.Date

Joseph C

_________________
JosephC


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 6:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sorry, but your questions are inconsistent.

in the first part you say there is an error, in the second you say it generates but with something you don't like.

And there is no template to change, you need to fix the type mapping.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 6:38 am 
Beginner
Beginner

Joined: Tue Sep 19, 2006 5:46 am
Posts: 21
Location: india
by error i meant was that:

if i gave jdbc type as "datetime" and java type as " java.util.Date" then it generated an error "not a valid sql type"

the other scinario is:

If i gave jdbc type as "DATE" and java type as " java.util.Date" then it generates the type as "timestamp" instead of java.util.Date

this is what i meant

Regards,

Joseph.C

_________________
JosephC


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 6:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes and datetime is not a valid sql type (e.g. it is not listed in java.sql.Types)

as I said before, then use whatever numerical value your db driver returns for whatever you call datetime.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 6:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
or override the hibernate type specifically for each relevant column.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.