Hi all,

Has anyone seen anything like this before?

I doing an import of a bunch of records in a file.  The entities are created
just fine, until I try to set the parent on one of them.  The CMR is
self-referential -- the parent is a record in the same table.  There is only
a get/setParent call, no get/setChildren (Collection) accessors.  

When I call entityLocal.setParent(entityLocal), I get the following
exception:

java.lang.IllegalArgumentException: Attempt to get lock ref with a null
object
        at org.jboss.ejb.BeanLockManager.getLock(BeanLockManager.java:80)
        at
org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java
:81)
        at
org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationIntercep
tor.java:53)
        at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.
java:84)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.j
ava:243)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
        at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117
)
        at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
        at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinder
Interceptor.java:122)
        at
org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:483)
        at org.jboss.ejb.Container.invoke(Container.java:674)
        at
org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactor
y.java:353)
        at
org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
        at $Proxy2302.setParent(Unknown Source)

I get this whether I cache the value of entityLocal from earlier create()
cached from a previous iteration or I use a finder method on the home
interface.  The finder method returns fine, it's just a problem to send the
result in to set the parent with it.

So the SessionBean class looks like the following.  The two key lines are
highlighted.  Is the problem something to do with the fact that this code is
all running within the same transaction?  

public abstract class ImportManagerBean implements SessionBean {

    public void doImport(String xml, String dtd) {
        ... bunch of xml DOM parsing deleted...
        for (int it = 0; it < nodesCount; it++) {
...
            if(isChild) {
 ---->>>        parent = glHome.findByName(name);
            }
            GL_AccountLocal gla = glHome.create();
            gla.setContent(...);
            if (parent != null) {
----->>>        gla.setParent(parent);
            } 
        }
    }
}

<ejb-relation >
   <ejb-relation-name>AccountBean-parent</ejb-relation-name>

   <ejb-relationship-role >
      <ejb-relationship-role-name>fromChild</ejb-relationship-role-name>
      <multiplicity>One</multiplicity>
      <relationship-role-source >
         <ejb-name>GL_Account</ejb-name>
      </relationship-role-source>
      <cmr-field >
         <cmr-field-name>parent</cmr-field-name>
      </cmr-field>
   </ejb-relationship-role>

   <ejb-relationship-role >
      <ejb-relationship-role-name>fromParent</ejb-relationship-role-name>
      <multiplicity>One</multiplicity>
      <relationship-role-source >
         <ejb-name>GL_Account</ejb-name>
      </relationship-role-source>
   </ejb-relationship-role>

</ejb-relation>

I looked around on the lists, traced into the code, etc.  Can't figure out
what is going on.  Thanks for reading this far!

Brian


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to