cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcin Skladaniec (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAY-1195) cannot access a many to many relationship before commit
Date Sun, 15 Mar 2009 07:57:16 GMT
cannot access a many to many relationship before commit
-------------------------------------------------------

                 Key: CAY-1195
                 URL: https://issues.apache.org/cayenne/browse/CAY-1195
             Project: Cayenne
          Issue Type: Bug
          Components: Cayenne Core Library
    Affects Versions: 3.0M6
         Environment: ROP
            Reporter: Marcin Skladaniec


the many to many relationship cannot be accessed from the other side that it was set.

test case (sorry not as a patch, to much other modifications to be able to create a diff)

 public void testCAY1195() throws Exception {
        deleteTestData();
        
        ClientMtTable4 parentMt = context.newObject(ClientMtTable4.class);
        ClientMtTable5 childMt5 = context2.newObject(ClientMtTable5.class); // I added context2
to the RemoteCayenneCase. it is created the same way as the original context
        
        assertEquals(0,parentMt.getTable5s().size());
        assertEquals(0,childMt5.getTable4s().size());
        
        ClientMtTable4 parentMtCopy = (ClientMtTable4)context2.localObject(parentMt.getObjectId(),
null);
        childMt5.addToTable4s(parentMtCopy);
        
        assertEquals(1,parentMtCopy.getTable5s().size());
        assertEquals(1,childMt5.getTable4s().size());
    }


this test throws a following exception:
Tests run: 17, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 0.415 sec <<< FAILURE!
testCAY1195(org.apache.cayenne.remote.NestedObjectContextTest)  Time elapsed: 0.016 sec  <<<
ERROR!
org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT ${project.build.date} ${project.build.time}]
Can't build a query for temporary id: <ObjectId:MtTable4, TEMP:0191B517AE610004>
	at org.apache.cayenne.query.ObjectIdQuery.createReplacementQuery(ObjectIdQuery.java:124)
	at org.apache.cayenne.query.IndirectQuery.getReplacementQuery(IndirectQuery.java:74)
	at org.apache.cayenne.query.IndirectQuery.route(IndirectQuery.java:57)
	at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:414)
	at org.apache.cayenne.access.DataDomainQueryAction.access$0(DataDomainQueryAction.java:401)
	at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:395)
	at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:846)
	at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:392)
	at org.apache.cayenne.access.UnitTestDomainQueryAction.runQueryInTransaction(UnitTestDomainQueryAction.java:54)
	at org.apache.cayenne.access.DataDomainQueryAction.interceptOIDQuery(DataDomainQueryAction.java:156)
	at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:113)
	at org.apache.cayenne.access.UnitTestDomainQueryAction.execute(UnitTestDomainQueryAction.java:48)
	at org.apache.cayenne.access.UnitTestDomain.onQuery(UnitTestDomain.java:63)
	at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
	at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
	at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1268)
	at org.apache.cayenne.access.ClientServerChannelQueryAction.runQuery(ClientServerChannelQueryAction.java:119)
	at org.apache.cayenne.access.ClientServerChannelQueryAction.execute(ClientServerChannelQueryAction.java:65)
	at org.apache.cayenne.access.ClientServerChannel.onQuery(ClientServerChannel.java:81)
	at org.apache.cayenne.remote.service.DispatchHelper.dispatch(DispatchHelper.java:39)
	at org.apache.cayenne.remote.service.LocalConnection.doSendMessage(LocalConnection.java:125)
	at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:72)
	at org.apache.cayenne.unit.UnitLocalConnection.sendMessage(UnitLocalConnection.java:49)
	at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:280)
	at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:112)
	at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
	at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
	at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:348)
	at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:338)
	at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:144)
	at org.apache.cayenne.testdo.mt.auto._ClientMtTable4.getTable5s(_ClientMtTable4.java:21)
	at org.apache.cayenne.remote.NestedObjectContextTest.testCAY1(NestedObjectContextTest.java:642)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message