Hi mates, although I'm not a long-experienced hibernate user, I've been working on it for a few weeks. I've used several tools to generate my project's mapping files (*.hbm.xml) and the configuration file (hibernate.cfg.xml). I've also adjusted some classes to my needs and the right mapping files as well.
The problem comes when I try to test the whole thing. For this purpose, I've done a class called TestCorePackage. When I execute it I always get the same error at line
Code:
Configuration conf = new Configuration();
The following code is a snipped of the mentioned class:
Code:
public static void main(String[] args)
{
System.out.println("Executing main method...");
// Load configuration data from hibernate.cfg.xml file
File cfgfile = new File("C:\\eclipse\\workspace\\test\\config\\hibernate\\hibernate.cfg.xml");
Configuration conf = new Configuration(); // <---- HERE IT CRASHES!!!
System.out.println("Configuration object created!");
conf = conf.configure(cfgfile);
System.out.println("Configuration loaded!");
File core_mappings = new File( "C:\\eclipse\\workspace\\test\\lib\\hibernate-core-mappings.jar" );
System.out.println("Mapping files loaded!");
conf.addJar(core_mappings);
SessionFactory sf = conf.buildSessionFactory();
System.out.println("DONE!");
... more code ...
}
The output is:
Code:
Executing main method...
java.lang.UnsupportedClassVersionError: org/hibernate/cfg/Configuration (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at com.fresh.uvs.entity.tests.TestCorePackage.main(TestCorePackage.java:45)
Exception in thread "main"
Do you know why is this happing?