0

I have an application which generate entities and hbm files hibernate using reverse engineering from a database. I created a void-main java Class to test queries and to launch a simple query I get the following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/hibernate/Session : Unsupported major.minor version 52.0

my environment is:

--Eclipse: Luna 2 (4.4.2)
--Tomcat 7
--JRE: jdk 7
--Java Compiler javaSE-1.7
--Maven dependencies:
   -junit 3.8.1
   -jboss-annotations-ejb3: 4.2.2.GA
   -mysql-connector-java: 5.1.39
   -javaee-api: 7.0
   -hibernate-tools: 5.2.0. Alpha3
--Some files jar added by maven:
    -hibernate-core-5.2.1.Final.jar
    -hibernate-commons-annotations-5.0.0.Final.jas
    -hibernate-jpa-2.1 -api-1.0.0.Final.jar

the void-main class is in a project, the pojos and hbm files hibernate generated by another, both projects by maven dependencies between them, have the same POM. The pojos generated have annotations.

to make a first query to hibernate throw the Query class appears as deprecated, I switched to another query without the Query class, using directly:

List listQuery = session.createQuery("from entity").list();

but I have the same error. I can not be where error with version:

  - Java: version 52.0 = Java SE 8 ?
   - Version hibernate ?
   - Annotations EJB3 ?
   - JRE ?
   -Compiler?
   ...

If anyone has a recommendation while I'm still looking, you would appreciate. thanks in advance

Angel Picallo
  • 69
  • 1
  • 5
  • You need Java 8... – ppeterka Aug 10 '16 at 14:11
  • I've seen all similar questions but do not treat my problem. I have only the error when using hibernate, for that reason wanted to know if there was any restriction hibernate depending on the version of java. For reasons of customer specification must be in java 7. I think I have to change to an earlier version of hibernate. Previously I've never had this problem with versions of hibernate and java – Angel Picallo Aug 10 '16 at 16:11
  • finally the problem was solved using an earlier version of hibernate – Angel Picallo Aug 10 '16 at 21:32

0 Answers0