Bugs item #889337, was opened at 2004-02-03 00:10
Message generated for change (Comment added) made by loubyansky
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=889337&group_id=22866

Category: JBossCMP
Group: CVS HEAD
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Rich C. (rchristy63)
Assigned to: Alexey Loubyansky (loubyansky)
Summary: Read-ahead fails on one-to-one relationship

Initial Comment:
OS: Linux Redhat 9/Windows XP 
JDK: 1.4.2
JBOSS version: cvs head as of 1/21/03 (3.2.4 R1)

Since JBOSS only allows one table per bean, we simulate
inheritance of entity beans using delegation.    So say
Bean A is a base class, Bean B has a getBeanA() method
which delegates all "inherited" calls through this
one-to-one relationship.   This has worked correctly on
past releases of JBOSS.  However in the version I built
off the cvs head, we noticed the following behavior by
stepping through the cmp code.  If Bean B has a preload
strategy of none, than everything works correctly.  I
can read one or many Bean Bs and everything works. 
However, changing preload strategy to either
on-find/on-load, causes the following exception only if
multiple bean Bs are returned by a finder (the first
one successfully is read and cached, the error occurs
on the second bean always retrieving the getBeanA
relation from the preload cache)

15:30:08,759 ERROR [LogInterceptor]
TransactionRolledbackLocalException in method: public
abstract java.util.Map
com.rcm.securitiesservice.ejbinterfaces.domain.Security.getSecurityProperties(),
causedBy:
javax.ejb.NoSuchObjectLocalException: New value
[2850513] of a foreign key field securityID changed the
value of a primary key field securityID[null]
        at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:142)
        at
org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
        at
org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:54)
        at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:147)
        at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
        at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
        at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
        at
org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:489)
        at
org.jboss.ejb.Container.invoke(Container.java:700)
        at
org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375)
        at
org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
        at $Proxy1441.getSecurityProperties(Unknown Source)
        at
com.rcm.securitiesservice.serversupport.SecuritiesValueObjectFactory.fillSecurityValueObject(SecuritiesValueObjectFactory.java:499)


We are just if something has changed to cause this to
no longer work.  Preloading strategy seems to work
correctly for other one-to-one relationships, just not
this particular relationship

Thanks,

Rich


----------------------------------------------------------------------

>Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-02-04 23:24

Message:
Logged In: YES 
user_id=543482

Yes, it is in the CVS. Perhaps, you will need to wait for
some time to be able to checkout the fix with pserver.

The fix is in JDBCCMP2xFieldBridge in setInstanceValue
method. This is it:

   public void setInstanceValue(EntityEnterpriseContext ctx,
Object value)
   {
      FieldState fieldState = getFieldState(ctx);

      // update current value
      if(cmpFieldIAmMappedTo != null &&
cmpFieldIAmMappedTo.isPrimaryKeyMember())
      {
         // if this field shares the column with the primary
key field and new value
         // changes the primary key then we are in an
illegal state.
         if(value != null)
         {
            if(fieldState.isLoaded() &&
fieldState.isValueChanged(value))
            {
               throw new IllegalStateException(
                  "New value [" + value + "] of a foreign
key field "
                  + getFieldName()
                  + " changed the value of a primary key field "
                  + cmpFieldIAmMappedTo.getFieldName()
                  + "[" + fieldState.value + "]"
               );
            }
            else
            {
               fieldState.setValue(value);
            }
         }
      }
      else the same

----------------------------------------------------------------------

Comment By: Rich C. (rchristy63)
Date: 2004-02-04 22:31

Message:
Logged In: YES 
user_id=959867

Is it in CVS?  I just did a CVS update and still see the same 
exception?  I'm using the 3_2 branch.

Thanks

----------------------------------------------------------------------

Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-02-04 21:48

Message:
Logged In: YES 
user_id=543482

Fixed in 3.2.4RC1 and 4.0.0DR3. Thanks.

----------------------------------------------------------------------

Comment By: Rich C. (rchristy63)
Date: 2004-02-04 18:46

Message:
Logged In: YES 
user_id=959867

Let me start with providing you the trace you need and the 
source for the two beans involved.  I believe the declaring 
right, but maybe you will spot something looking at the 
xdoclet.  SecurityBean is the "inherited class" and EquityBean 
is the "derived bean".  The relationship that is failing is the 
getSecurity() relationship.


System Thread [RMI TCP Connection(14)-10.0.182.61] 
(Suspended (breakpoint at line 195 in JDBCCMP2xFieldBridge))
        JDBCCMP2xFieldBridge.setInstanceValue
(EntityEnterpriseContext, Object) line: 195
        JDBCCMRFieldBridge.setForeignKey
(EntityEnterpriseContext, Object) line: 1305
        JDBCCMRFieldBridge.load(EntityEnterpriseContext, 
Collection) line: 1287
        ReadAheadCache.load(EntityEnterpriseContext) line: 
392
        JDBCStoreManager.activateEntity
(EntityEnterpriseContext) line: 587
        CMPPersistenceManager.activateEntity
(EntityEnterpriseContext) line: 372
        CachedConnectionInterceptor.activateEntity
(EntityEnterpriseContext) line: 336
        InvalidableEntityInstanceCache
(EntityInstanceCache).activate(EnterpriseContext) line: 109
        InvalidableEntityInstanceCache
(AbstractInstanceCache).get(Object) line: 108
        InvalidableEntityInstanceCache
(EntityInstanceCache).get(Object) line: 61
        EntityInstanceInterceptor.invoke(Invocation) line: 
137
        EntityLockInterceptor.invoke(Invocation) line: 89
        EntityCreationInterceptor.invoke(Invocation) line: 54
        TxInterceptorCMT
(AbstractTxInterceptor).invokeNext(Invocation, boolean) line: 
84
        TxInterceptorCMT.runWithTransactions(Invocation) 
line: 313
        TxInterceptorCMT.invoke(Invocation) line: 147
        SecurityInterceptor.invoke(Invocation) line: 118
        LogInterceptor.invoke(Invocation) line: 191
        ProxyFactoryFinderInterceptor.invoke(Invocation) 
line: 122
        EntityContainer.internalInvoke(Invocation) line: 489
        EntityContainer(Container).invoke(Invocation) line: 
700
        BaseLocalProxyFactory.invoke(Object, Method, 
Object[]) line: 375
        EntityProxy.invoke(Object, Method, Object[]) line: 
38
        $Proxy193.getSecurityProperties() line: not available
        SecuritiesValueObjectFactory.fillSecurityValueObject
(Security, SecurityValue) line: 499
        SecuritiesValueObjectFactory.fillEquitySecurityValue
Object(Equity, EquityValue) line: 560
        SecuritiesValueObjectFactory.createEquityValueObje
ct(Equity) line: 362
        CalypsoEquitiesServiceBean.findEquitiesWithCrossRef
erence(EquitySearchCriteria) line: 83
        NativeMethodAccessorImpl.invoke0(Method, Object, 
Object[]) line: not available [native method]
        NativeMethodAccessorImpl.invoke(Object, Object[]) 
line: 39
        DelegatingMethodAccessorImpl.invoke(Object, Object
[]) line: 25
        Method.invoke(Object, Object[]) line: 324
        StatelessSessionContainer$ContainerInterceptor.invo
ke(Invocation) line: 683
        CachedConnectionInterceptor.invoke(Invocation) 
line: 185
        StatelessSessionInstanceInterceptor.invoke
(Invocation) line: 72
        TxInterceptorCMT
(AbstractTxInterceptor).invokeNext(Invocation, boolean) line: 
84
        TxInterceptorCMT.runWithTransactions(Invocation) 
line: 313
        TxInterceptorCMT.invoke(Invocation) line: 147
        SecurityInterceptor.invoke(Invocation) line: 118
        LogInterceptor.invoke(Invocation) line: 191
        ProxyFactoryFinderInterceptor.invoke(Invocation) 
line: 122
        StatelessSessionContainer.internalInvoke
(Invocation) line: 331
        StatelessSessionContainer(Container).invoke
(Invocation) line: 700
        GeneratedMethodAccessor50.invoke(Object, Object
[]) line: not available
        DelegatingMethodAccessorImpl.invoke(Object, Object
[]) line: 25
        Method.invoke(Object, Object[]) line: 324
        ReflectedDispatcher.dispatch() line: 72
        Invocation.dispatch() line: 45
        Invocation.invoke() line: 70
        XMBean(AbstractMBeanInvoker).invoke(String, 
Object[], String[]) line: 187
        MBeanServerImpl.invoke(ObjectName, String, Object
[], String[]) line: 480
        JRMPInvoker.invoke(Invocation) line: 367
        NativeMethodAccessorImpl.invoke0(Method, Object, 
Object[]) line: not available [native method]
        NativeMethodAccessorImpl.invoke(Object, Object[]) 
line: 39
        DelegatingMethodAccessorImpl.invoke(Object, Object
[]) line: 25
        Method.invoke(Object, Object[]) line: 324
        UnicastServerRef2(UnicastServerRef).dispatch
(Remote, RemoteCall) line: 261
        Transport.run() line: 148
        AccessController.doPrivileged
(PrivilegedExceptionAction, AccessControlContext) line: not 
available [native method]
        TCPTransport(Transport).serviceCall(RemoteCall) 
line: 144
        TCPTransport.handleMessages(Connection, boolean) 
line: 460
        TCPTransport$ConnectionHandler.run() line: 701
        Thread.run() line: 534

I've attached a zip file containing the two beans.  Let me 
know what else you need.

Thanks

----------------------------------------------------------------------

Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-02-04 17:47

Message:
Logged In: YES 
user_id=543482

The foreign key must be mapped to primary key column[s]. I
need more details to reproduce this. My simple tests pass.
This stacktrace snippet does not help. It would be helpful
to see the stacktrace starting from JDBCCMP2xFieldBridge. If
you have a testcase, please, attach.
Thanks.

----------------------------------------------------------------------

Comment By: Rich C. (rchristy63)
Date: 2004-02-03 00:14

Message:
Logged In: YES 
user_id=959867

Just to clarify, this works correctly with JBOSS version
3.2.2RC4 and 3.2.3RC1, but not in 3.2.4RC1 that we built
from the cvs head.

Thanks again,

Rich

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=889337&group_id=22866


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to