Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate mapping problem

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to run hibernate example


above is my main class.


below is my model class



file

here is the cfg  file.



I am using oracle 11g database.

I am getting below exception



i tried to find solution in internet.Most of guys says compile jdk version and run runtime version difference may be the problem.But i am using same version in eclipse.


hibernate.png
[Thumbnail for hibernate.png]
screenshot
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem's not in your mapping, it's in a compiler version mismatch. The error indicates that the Hibernate classes are compiled against Java 8 (version 52.0). You're running it with Java 7 though. You'll need to either find a Java 7 compatible Hibernate version, or upgrade to Java 8.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but i dont have Java 8 installed. I only have java 7 and java 6 versions only. it should be another reason.
 
Dave Tolls
Ranch Hand
Posts: 2102
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simplest solution, if you can't install a Java 8 JRE, is to get hold of Hibernate 5.1.
That was the last version that was 1.7 compatible.
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liya wrote:it should be another reason.

There isn't. As Dave indicated, Hibernate 5.2 is built on Java 8; you will need the latest 5.1 version if you need to keep using Java 7.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THANKS  ALL.I change the hibernate version to 5.1 and its fine now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic