Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Hibernate 3 calendar_date adds time with JDK 1.8
PostPosted: Tue May 16, 2017 9:05 am 
Newbie

Joined: Tue Jul 26, 2011 1:30 am
Posts: 5
When we upgraded from weblogic 9c(JDK 1.5) to weblogic 12c(JDK 1.8), hibernate type calendar_date is adding time to the field. Except weblogic version nothing else has changed. In weblogic 9c the same column is getting populated with only Date(with out time), but in weblogic 12c column is getting populated with Date along with Time. Could some one guide me in right direction?

<property name="hireDate" column="hire_date" type="calendar_date"/>

weblogic 9c
hire_date = 05/15/2017

weblogic 12c
hire_date = 05/15/2017 08:22:36


Top
 Profile  
 
 Post subject: Re: hibernate3 calendar_date adds time with JDK 1.8
PostPosted: Tue May 16, 2017 9:14 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1385
I can't tell how Hibernate 3 is working since I don't have that branch and we don't maintain 3.x or 4.x branches anymore.

However, on 5.2, the calendar_date Type uses the following descriptors:

Code:
public CalendarDateType() {
    super( DateTypeDescriptor.INSTANCE, CalendarDateTypeDescriptor.INSTANCE );
}


And the DateTypeDescriptor SQL descriptor calls the setDate method on the underlying PreparedStatement:

Code:
final Date date = javaTypeDescriptor.unwrap( value, Date.class, options );
if ( value instanceof Calendar ) {
   st.setDate( index, date, (Calendar) value );
}
else {
   st.setDate( index, date );
}


So, everything looks fine. Maybe it's the JDBC Driver causing some issues. Make sure you update the JDBC driver as well.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Hibernate 3 calendar_date adds time with JDK 1.8
PostPosted: Tue May 16, 2017 9:20 am 
Newbie

Joined: Tue Jul 26, 2011 1:30 am
Posts: 5
Thanks for the quick reply, we are using ojdbc7.jar as JDBC driver, With Hibernate10gDialect.


Top
 Profile  
 
 Post subject: Re: Hibernate 3 calendar_date adds time with JDK 1.8
PostPosted: Tue May 16, 2017 10:20 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1385
You can debug it and see who is causing the issue. That's the only way you can figure it out.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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.