Hi, this is my first attempt at using Hibernate. I've used a top up approach, using Middelgen / hbm2java to generate mappings and source from an existing db. Everything compiles fine but running causes the following errors below, as far as I can tell, my classpath is correctly set up as it compiles and run without problems (until this exception). Any help would be most appreciated,
thanks.
Hibernate version: 3.1.2
Code between sessionFactory.openSession() and session.close():
Transaction tx = session.beginTransaction();
Colour newColour = new Colour();
newColour.setName("Blue");
newColour.setPicture("c:\blue.jpg");
session.save(newColour);
tx.commit();
Full stack trace of any exception that occurs: ERROR - CGLIB Enhancement failed: beayens.hibernate.Colour
java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at beayens.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13)
at beayens.hibernate.EventManager.main(EventManager.java:9)
WARN - could not create proxy factory for:beayens.hibernate.Colour
org.hibernate.HibernateException: CGLIB Enhancement failed: beayens.hibernate.Colour
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at beayens.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13)
at beayens.hibernate.EventManager.main(EventManager.java:9)
Caused by: java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyIni
tializer.java:116)
... 13 more
Name and version of the database you are using:
MySQL (InnoDB)
|