[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1189?page=c...
]
Benoit Goudreault-Emond updated HHH-1189:
-----------------------------------------
Attachment: eg.zip
This code sample is a Maven project that builds against 3.2.2 GA and reproduces the
problem in the test case (simply run "mvn test").
Briefly, this occurs when subclasses are given interfaces, but the parent class does not
implement one. Note how DoctorImpl has a proxy declaration, but not Person.
Why would one do this? Well, in cases where a few extra methods are used only for certain
subclasses, it is important to provide them through an interface so they are accessible
even if the class returned by Hibernate is a proxy. Putting all methods of the base class
in some base interface does fix the problem, but it's an annoying extra step.
Note that even if the bug described here is fixed, there are other problems in those
situations, especially in the presence of access="field". I'm currently
trying to isolate this. I suspect HHH-1953 is related to that problem.
interfaces for Proxies are not regonized as interfaces
------------------------------------------------------
Key: HHH-1189
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1189
Project: Hibernate3
Issue Type: Patch
Components: core
Affects Versions: 3.1 rc3
Environment: Discovered on Hibernate 3.0, still present in 3.1rc3
Reporter: Tobias
Assignee: Steve Ebersole
Priority: Critical
Attachments: eg.zip
Original Estimate: 1 hour
Remaining Estimate: 1 hour
In org.hibernate.tuple.PojoEntityTuplizer line 119 reads:
if ( !proxyInterface.isInterface() ) {
and should be
if ( !subclassClass.isInterface() ) {
So the code then would look like this:
Subclass subclass = ( Subclass ) iter.next();
Class subclassProxy = subclass.getProxyInterface();
Class subclassClass = subclass.getMappedClass();
if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) {
if ( !subclassProxy.isInterface() ) { // HERE!
throw new MappingException(
"proxy must be either an interface, or the class itself: " +
subclass.getEntityName()
);
}
proxyInterfaces.add( subclassProxy );
}
After that change the specified interfaces for subclass proxies are regonized as such.
Without this patch the superclass is checked, which may not have/be an interface as proxy
class.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira