• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate mapping problem

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THANKS  ALL.I change the hibernate version to 5.1 and its fine now.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic