Complex Collection Properties & Statement Namespaces
----------------------------------------------------

         Key: IBATIS-33
         URL: http://nagoya.apache.org/jira/browse/IBATIS-33
     Project: iBatis for Java
        Type: Bug
  Components: SQL Maps  
    Versions: 2.0.8    
 Environment: Windows XP - Weblogic 8.1.4 - Oracle 8.1.7
Spring with IBATIS 2.0.8
    Reporter: Aymeric Alibert


Complex collection properties does not seem to work when statement namespaces 
are enabled.
I have a running application developped using IBATIS 2.0.8. I decided to enable 
statement namespaces and did the following changes:
sql-map.config: 
<settings useStatementNamespaces="true"/>

java class:
public AgentAccount findAccountByAgentId(String agentId) {
        return (AgentAccount) 
getSqlMapClientTemplate().queryForObject("MyNameSpace.getAgentAccountById",agentId);
}

sqlmap.xml:
<sqlMap namespace="MyNameSpace">
    <resultMap id="agentAccountResult" 
class="com.alliantenergy.csi.energyassistance.business.domain.AgentAccount">
        <result property="agentId" column="AGENT_ID"/>
        <result property="roles" column="AGENT_ID" 
select="MyNameSpace.getAgentRoles"/>
    </resultMap>

    <select id="getAgentAccountById" resultMap="agentAccountResult">
    select
          AGENT_ID
      from EAC_AGENT
    where AGENT_ID = #value#
    </select>

    <select id="getAgentRoles" resultClass="int">
    select ROLE_ID from EAC_AGENT_ROLE where AGENT_ID = #value#
    </select>

Note that I am using 'MyNameSpace.getAgentRoles' for the sub query.
IBATIS load the map fine but fails at runtime with the following exception:

        java.io.NotSerializableException: 
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader
java.rmi.UnmarshalException: cannot unmarshaling return; nested exception is:
        java.io.NotSerializableException: 
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader
        at 
weblogic.rmi.internal.ServerRequest.unmarshalReturn(ServerRequest.java:102)
        at 
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:285)
        at 
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
        at 
com.alliantenergy.csi.energyassistance.remote.ejb.AccountManagement_cqphao_EOImpl_813_WLStub.authenticate(Unknown
 Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at 
org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke(RmiClientInterceptorUtils.java:103)
        at 
org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:76)
        at 
org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:78)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:143)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
        at $Proxy16.authenticate(Unknown Source)
        at 
com.alliantenergy.csi.ui.energyassistance.presentation.agentservice.LogonAction.doExecute(LogonAction.java:88)
        at 
com.alliantenergy.csi.ui.energyassistance.framework.struts.BaseAction.execute(BaseAction.java:126)
        at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
        at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
        at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
        at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
        at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
        at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
        at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at 
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
        at 
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
        at 
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.io.NotSerializableException: 
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
        at 
weblogic.rmi.internal.CBVOutputStream.writeObject(CBVOutputStream.java:78)
        at 
weblogic.rmi.internal.ServerRequest.unmarshalReturn(ServerRequest.java:94)
        ... 31 more



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to