|
From: <leg...@at...> - 2003-07-30 01:36:14
|
Message:
The following issue has been closed.
Resolver: Gavin King
Date: Tue, 29 Jul 2003 8:34 PM
Now fixed in CVS.
Thanks! (it was a simple little oversight)
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-218
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-218
Summary: Interface as class type for <many-to-one/> property
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Project: Hibernate2
Components:
core
Fix Fors:
2.0.2
Versions:
2.0 final
Assignee:
Reporter: Chris Hane
Created: Mon, 28 Jul 2003 2:21 PM
Updated: Tue, 29 Jul 2003 8:34 PM
Environment: java 1.3.1_04
Description:
Is it legal to map a many-to-one class to an interface. I have done this with
the father property (in the attached example), however, I am receiving errors when I try to load records where
the parent property is not null.
I have attached a set of files that demonstrate the error I am getting. To use:
1. run the sql script to build files and populate data
Note: I'm using MySQL so you might have to change for a different DB
2. Change eg.test configuration properites to reflect your DB setup
3. Run eg.test
Everything should work fine and "Detail B1 - F3" should be printed
to the output
4. Now in eg.test, change the configuration to use eg.IFather instead of eg.Father
5. In IDetail, change the m-1 father property from eg.Father to eg.IFather
6. Re-run and you will get this error.
Exception in thread "main" java.lang.IllegalArgumentException: No visible constructors in interface eg.IFather
at net.sf.cglib.EnhancerGenerator.<init>(EnhancerGenerator.java:128)
at net.sf.cglib.Enhancer.enhanceClassHelper(Enhancer.java:224)
at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:206)
at net.sf.cglib.Enhancer.enhance(Enhancer.java:162)
at net.sf.cglib.Enhancer.enhance(Enhancer.java:139)
at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:26)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901)
at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710)
at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48)
at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55)
at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153)
at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49)
at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>)
at com.test.main(test.java:39)
rethrown as net.sf.hibernate.HibernateException: CGLIB Enhancement failed: No visible constructors in interface eg.IFather
at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:37)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901)
at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710)
at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48)
at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55)
at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153)
at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49)
at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>)
at com.test.main(test.java:39)
rethrown as net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem: CGLIB Enhancement failed: No visible constructors in interface eg.IFather
at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:59)
at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153)
at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49)
at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>)
at eq.test.main(test.java:43)
Chris....
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|