-->
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: date Type (Hibernate type, date & time for Oracle DATE??
PostPosted: Thu Feb 23, 2006 9:50 pm 
Newbie

Joined: Thu Feb 23, 2006 9:28 pm
Posts: 1
Hibernate 3.0.5


<property name="startDateTime" type="date">
<column name="START_DATE_TIME" length="12" />
</property>
<property name="finishDateTime" type="date">
<column name="FINISH_DATE_TIME" length="12" />
</property>


Oracle PL/SQL Release 8.1.5.0.0

If I use the above mappings it should result in a java.util.Date object. This is ok, however when I try to reference the minutes, aDate.getMinutes(), I get an Unhandled Exception thrown: class java.lang.IllegalArgumentException

Does the Hibernate Date type ONLY query the date part (no time part) of an Oracle DATE column? Will I need to make schema changes to separate the date and time part for each column? Ie. START_DATE; START_TIME; FINISH_DATE; FINISH_TIME;


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 6:45 am 
Beginner
Beginner

Joined: Wed Aug 04, 2004 4:33 am
Posts: 45
Location: Switzerland
Check if it is an instance of java.sql.Date
This class extends java.util.Date but removes the Time part of it, just like java.sql.Time does the other way round.

If you want the date including Date and Time you need the type Timestamp on the database. This would the return java.sql.Timestamp which contains Date and Time.


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.