
| Key: |
HHH-361
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Rejected
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Robert Watkins
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
Hibernate3
Created: 18/Apr/05 02:11 AM
Updated: 19/Apr/05 12:38 AM
|
|
| Component/s: |
core
|
| Affects Version/s: |
3.0 final
|
| Fix Version/s: |
None
|
|
|
Original Estimate:
|
Unknown
|
Remaining Estimate:
|
Unknown
|
Time Spent:
|
Unknown
|
|
Environment:
|
Hibernate 3.0, Oracle
|
|
|
Classes that previously worked fine with Hibernate 2.1.6 are having problems with Hibernate 3.0 because they have private zero-arg constructors.
If the constructors are made package-private or higher, it works fine.
This may be a bug in the version of cglib distributed with Hibernate 3.0 (cglib-2.1)
Example class (based on real scenario):
package foo.bar;
public class Foo {
private Bar bar;
/** for hibernate */
private Foo() { }
public Foo(Bar aBar) { setBar(aBar); }
public Bar getBar() { return bar; }
private void setBar(Bar aBar) { bar = aBar; }
}
Stack trace:
18/04/2005 17:05:24 org.hibernate.proxy.CGLIBLazyInitializer getProxyFactory SEVERE: CGLIB Enhancement failed: foo.bar.Foo
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:682)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:494)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:373)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:281)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:640)
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:94)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:42)
at org.hibernate.tuple.PojoTuplizer.buildProxyFactory(PojoTuplizer.java:139)
at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:83)
at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:54)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:47)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:212)
at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:199)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
at foo.bar.HibernateConfigTest.testCreateSessionFactory(HibernateConfigTest.java:152)
...
|
|
Description
|
Classes that previously worked fine with Hibernate 2.1.6 are having problems with Hibernate 3.0 because they have private zero-arg constructors.
If the constructors are made package-private or higher, it works fine.
This may be a bug in the version of cglib distributed with Hibernate 3.0 (cglib-2.1)
Example class (based on real scenario):
package foo.bar;
public class Foo {
private Bar bar;
/** for hibernate */
private Foo() { }
public Foo(Bar aBar) { setBar(aBar); }
public Bar getBar() { return bar; }
private void setBar(Bar aBar) { bar = aBar; }
}
Stack trace:
18/04/2005 17:05:24 org.hibernate.proxy.CGLIBLazyInitializer getProxyFactory SEVERE: CGLIB Enhancement failed: foo.bar.Foo
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:682)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:494)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:373)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:281)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:640)
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:94)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:42)
at org.hibernate.tuple.PojoTuplizer.buildProxyFactory(PojoTuplizer.java:139)
at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:83)
at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:54)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:47)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:212)
at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:199)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
at foo.bar.HibernateConfigTest.testCreateSessionFactory(HibernateConfigTest.java:152)
...
|
Show » |
|