-->
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.  [ 3 posts ] 
Author Message
 Post subject: Switching from ojdbc6.jar to ojdbc7.jar
PostPosted: Wed Jun 08, 2016 8:31 am 
Beginner
Beginner

Joined: Sat Feb 16, 2008 3:09 pm
Posts: 24
Hello,
we use an Oracle 11g Database. Up to now we have used ojdbc6.jar as the jdbc driver. The customer wishes to update to ojdbc7.jar.
With Hibernate 4.3, ojdbc6.jar and
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
the application works as expected. However when we switch to ojdbc7.jar
@NamedQuery(name = "Rechtsvorgang.findZulassungsarten", query = "SELECT r from Rechtsvorgang r WHERE r.kategorieNr >= :kategorieNrLower AND r.kategorieNr < :kategorieNrUpper AND gueltigVon >= :gueltigVon ORDER BY r.langname")
does not work any more. No exception is thrown. Simply an empty List is returned.
When I trace the Hibernate SQL with bound parameters and execute the SQL directly it returns the expected result.
I have tried to update to Hibernate 5.3 and
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect" />
to no avail. The error still persists.
Any ideas how to fix this?


Top
 Profile  
 
 Post subject: Re: Switching from ojdbc6.jar to ojdbc7.jar
PostPosted: Wed Jun 08, 2016 3:35 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I used both 6 and 7 ojdbc versions and they were working fine. You got to debug it through


Top
 Profile  
 
 Post subject: Re: Switching from ojdbc6.jar to ojdbc7.jar
PostPosted: Thu Jun 09, 2016 4:38 am 
Beginner
Beginner

Joined: Sat Feb 16, 2008 3:09 pm
Posts: 24
When I trace the Hibernate SQL with bound parameters and execute the SQL directly it returns the expected result.

DEBUG SQL - select rechtsvorg0_.nr as nr1_49_, rechtsvorg0_.kurzname as kurzname2_49_, rechtsvorg0_.langname as langname3_49_, rechtsvorg0_.entscheidungArt as entscheidungArt4_49_, rechtsvorg0_.gueltigBis as gueltigBis5_49_, rechtsvorg0_.gueltigVon as gueltigVon6_49_, rechtsvorg0_.kategorieNr as kategorieNr7_49_, rechtsvorg0_.objektArt as objektArt8_49_, rechtsvorg0_.refNr as refNr9_49_ from WR.WR_SL_RECHTSVORGANG rechtsvorg0_ where rechtsvorg0_.kategorieNr>=? and rechtsvorg0_.kategorieNr<? and rechtsvorg0_.gueltigVon>=? order by rechtsvorg0_.langname
TRACE BasicBinder - binding parameter [1] as [INTEGER] - [110]
TRACE BasicBinder - binding parameter [2] as [INTEGER] - [120]
TRACE BasicBinder - binding parameter [3] as [DATE] - [Tue Jan 01 10:15:52 CET 2013]

When I run
Code:
select rechtsvorg0_.nr as nr1_49_, rechtsvorg0_.kurzname as kurzname2_49_, rechtsvorg0_.langname as langname3_49_, rechtsvorg0_.entscheidungArt as entscheidungArt4_49_, rechtsvorg0_.gueltigBis as gueltigBis5_49_, rechtsvorg0_.gueltigVon as gueltigVon6_49_, rechtsvorg0_.kategorieNr as kategorieNr7_49_, rechtsvorg0_.objektArt as objektArt8_49_, rechtsvorg0_.refNr as refNr9_49_ from WR.WR_SL_RECHTSVORGANG rechtsvorg0_ where rechtsvorg0_.kategorieNr>=110 and rechtsvorg0_.kategorieNr<120 and rechtsvorg0_.gueltigVon>=to_date('01-01-2013', 'DD-MM-YYYY') order by rechtsvorg0_.langname

from SQL Developer I get the expected result. So it seems that Hibernate generates valid SQL.

After playing around I have found that apparently ojdbc7 does not work properly with date comparisons using >=.
After changing to >
Code:
@NamedQuery(name = "Rechtsvorgang.findZulassungsarten", query = "SELECT r from Rechtsvorgang r WHERE r.kategorieNr >= :kategorieNrLower AND r.kategorieNr < :kategorieNrUpper AND gueltigVon > :gueltigVon  ORDER BY r.langname")

and adusting the gueltigVon Parameter accordingly the application works as expected again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.