Tuesday 13 September 2011

Some notes about VaanNila's Hibernate Tutorial Examples

This note explains how to run the hibernate examples given
in VaanNila's Hibernate Tutorial.
http://www.vaannila.com/hibernate/hibernate-tutorial/hibernate-tutorial.html

ERRORS MESSAGES AND THE SOLUTIONS:


Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.vaannila.util.HibernateUtil.(HibernateUtil.java:14)


add commons-logging-1.1.1
------------------------------------
12.Eyl.2011 20:08:36 org.hibernate.cfg.Environment
INFO: Hibernate 3.2.5
12.Eyl.2011 20:08:36 org.hibernate.cfg.Environment
INFO: hibernate.properties not found
12.Eyl.2011 20:08:36 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib

...
INFO: building session factory
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.vaannila.util.HibernateUtil.(HibernateUtil.java:14)

cglib problem
add cglib.jar
-------------------------------
12.Eyl.2011 20:10:55 org.hibernate.impl.SessionFactoryImpl
INFO: building session factory
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/objectweb/asm/Type

cglib needs asm.jar
-------------------------------


INFO: exporting generated schema to database
12.Eyl.2011 20:12:25 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: schema export complete
Hibernate: insert into COURSES (COURSE_ID, COURSE_NAME) values (null, ?)
Hibernate: call identity()
Hibernate: insert into COURSES (COURSE_ID, COURSE_NAME) values (null, ?)
Hibernate: call identity()
Hibernate: insert into COURSES (COURSE_ID, COURSE_NAME) values (null, ?)
Hibernate: call identity()
Hibernate: select course0_.COURSE_ID as COURSE1_0_, course0_.COURSE_NAME as COURSE2_0_ from COURSES course0_
Physics
Chemistry
Maths
Hibernate: select course0_.COURSE_ID as COURSE1_0_0_, course0_.COURSE_NAME as COURSE2_0_0_ from COURSES course0_ where course0_.COURSE_ID=?
Hibernate: update COURSES set COURSE_NAME=? where COURSE_ID=?
Hibernate: select course0_.COURSE_ID as COURSE1_0_0_, course0_.COURSE_NAME as COURSE2_0_0_ from COURSES course0_ where course0_.COURSE_ID=?
Hibernate: delete from COURSES where COURSE_ID=?
Hibernate: select course0_.COURSE_ID as COURSE1_0_, course0_.COURSE_NAME as COURSE2_0_ from COURSES course0_
Physics
Mathematics

It works...
-----------
Directory of C:\Users\ars\Desktop\VN_Hibernate\HibernateExample1\lib

antlr-2.7.6.jar
asm.jar
cglib-2.2.jar
commons-collections-3.2.1.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
hibernate3.jar
hibernate-annotations
hibernate-commons-annotations
hsqldb.jar
javassist-3.4.GA.jar
jta-1.1.jar
slf4j-api-1.6.2.jar
slf4j-simple-1.6.2.jar