Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Hibernate mapping problem

 
Ranch Hand
Posts: 1325
1
  • 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
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • 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.
 
Rancher
Posts: 4612
47
  • 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
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • 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.
 
The only thing that kept the leeches off of me was this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic