• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Switching from ojdbc6.jar to ojdbc7.jar

 
Markus Schmider
Ranch Hand
Posts: 132
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

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?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15627
46
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a way to configure Hibernate to log the exact SQL statements it's issuing to the database. I don't remember exactly what the setting is right now, but you can look it up and enable it, so that you can see what Hibernate exactly is doing, and then you can check if it's doing something that is not correct.
 
Markus Schmider
Ranch Hand
Posts: 132
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have enabled logging of hibernate sql for log4j with


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



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 >

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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic