02-19-07 12:11 PM
[ https://issues.apache.org/jira/brow...action_12474120 ]
Andy Jefferson commented on JDO-466:
------------------------------------
The PK class for the OrderItem has an incorrect equals() method. It uses "==
" but should use equals() ... like this
public boolean equals(Object obj) {
if (obj==null || !this.getClass().equals(obj.getClass()))
return false;
OrderItemOid o = (OrderItemOid) obj;
if ((!this.order.equals(o.order)) || (this.item != o.item)) {
return false;
}
return true;
}
The use of == means that when performing reachability checks JPOX tries to r
emove all reachables from the collection of newly persisted object ids and f
ails to remove the OrderItem ... hence it gets deleted by reachability. Chan
ging the equals() as above
passes the test :-)
> Test for compound identity fails
> --------------------------------
>
> Key: JDO-466
> URL: https://issues.apache.org/jira/browse/JDO-466
> Project: JDO
> Issue Type: Bug
> Components: tck2
> Affects Versions: JDO 2 maintenance release 1
> Reporter: Michelle Caisse
> Assigned To: Andy Jefferson
>
> The new test CompletenessTestOrder (use compoundidentity.conf) fails on th
e RI. It appears that the OrderItem instances are not persisted to the datab
ase.
> [echo] Starting configuration="compoundidentity.conf" with databas
e="derby"identitytype="applicationidentity" mapping="".
> [java] RUN CompletenessTestOrder.test FAILURE
> [java] Description: Completeness test with standard mapping using
order model for compound identity testing
> [java] Time: 009
> [java] There was 1 failure:
> [java] 1) test(org.apache.jdo.tck.mapping.CompletenessTestOrder)ju
nit.framework.AssertionFailedError: CompletenessTestOrder failed; see list o
f failures below:
> [java] Expected this instance:
> [java] org.apache.jdo.tck.pc.order.Order@40b181
> [java] Got persistent instance:
> [java] org.apache.jdo.tck.pc.order.Order@1108727
> [java] Detailed list of differences follows...
> [java] Context: Order<1>.items
> [java] expected '[org.apache.jdo.tck.pc.order.OrderItem@2]'
> [java] actual '[]'
> [java]
> [java] at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:639)
> [java] at org.apache.jdo.tck.mapping.CompletenessTestOrder.te
st(CompletenessTestOrder.java:122)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeM
ethodAccessorImpl.java:39)
> [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Del
egatingMethodAccessorImpl.java:25)
> [java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:2
54)
> [java] at org.apache.jdo.tck.util.BatchTestRunner.doRun(Batch
TestRunner.java:108)
> [java] at org.apache.jdo.tck.util.BatchTestRunner.start(Batch
TestRunner.java:148)
> [java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunne
r.java:123)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[ Post a follow-up to this message ]
|