Hi ALL
I am beginner to Hibernate and new to this forum.
I just installed Hibernate and everything and wrote first program and got this error. I have made all the connections before and it seems some compatiblity issue. Please suggest what should i do and how should i go to get rid of it.
I have Eclipse, Hibernate and Derby. Hibernate Distribution 3.5 and annotation 3.4.0
I have cofig.hbm.xml and 1 employee class with JPA mappings. and one TestEmployee class with main () when i run this class ,i get the errors.
----------------------------------------- 18:54:24,990 INFO Version:15 - Hibernate Annotations 3.4.0.GA 18:54:25,005 INFO Environment:570 - Hibernate 3.5.4-Final 18:54:25,005 INFO Environment:603 - hibernate.properties not found 18:54:25,021 INFO Environment:781 - Bytecode provider name : javassist 18:54:25,021 INFO Environment:662 - using JDK 1.4 java.sql.Timestamp handling 18:54:25,161 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA 18:54:25,177 INFO Configuration:1518 - configuring from resource: hibernate.cfg.xml 18:54:25,177 INFO Configuration:1495 - Configuration resource: hibernate.cfg.xml 18:54:25,270 INFO Configuration:1633 - Configured SessionFactory: null 18:54:25,302 INFO Dialect:206 - Using dialect: org.hibernate.dialect.DerbyDialect Exception in thread "main" java.lang.IncompatibleClassChangeError: class org.hibernate.cfg.ExtendedMappings has interface org.hibernate.cfg.Mappings as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:187) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277) at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:838) at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128) at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91) at com.hibernate.chapter01.TestEmployee.main(TestEmployee.java:21) ----------------------------------------------
This is my TestEmployee class---- package com.hibernate.chapter01; //import javax.persistence.*; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.tool.hbm2ddl.SchemaExport;
public class TestEmployee { public static void main(String args[]) {
//To call hibernate,use AnnotationConfiguration class in the file //create am object of AnnotationConfiguration AnnotationConfiguration ac=new AnnotationConfiguration(); //Add annotated classes in the parameter,classes/entites whose tables need to be created ac.addAnnotatedClass(Employee.class); //ac.configure();//default hibernate.config.xml -configation fule ac.configure("hibernate.cfg.xml"); new SchemaExport(ac).create(true, true); } }
|