Class of lazy loaded objects loaded by a discriminator is incorrect -------------------------------------------------------------------
Key: IBATIS-463 URL: https://issues.apache.org/jira/browse/IBATIS-463 Project: iBatis for Java Issue Type: Bug Components: SQL Maps Affects Versions: 2.3.0 Reporter: Patrick Savage This is a known issue described in http://opensource.atlassian.com/confluence/oss/display/IBATIS/Lazy+loading+issues (issue #1). The problem is that since the proxy lazy result object extends the parent result map's class instead of the appropriate discriminator submap's class, there is no way to get the object as the discriminator submap's class. The correct subclass cannot be determined until the object is loaded so the proxy can't extend the subclass. So one way to fix this is to not lazy load the object which is the solution proposed in the wiki link above. However, that proposed solution is not ideal because the parent result map's class must be abstract which is not always the case. An alternative solution is to never lazy load objects that are loaded with a discriminator, even if lazy loading is enabled globally. I've attached a patch to version 2.3.0 that implements this. I think this issue is fairly major because there does not seem to be any way to get the subclass unless you use reflection to pull out the lazy loaded resultObject from the proxy (EnhancedLazyResultLoaderImpl). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.