gdamour 2005/07/09 09:33:38
Modified:
modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetomany
OneToManyTest.java
Log:
It is now possible to set the value of a CMP field mapped to a FK column, in
other words a CMR field. The previous implementation was only allowing for a
read access.
Note that in the case of a CMP field mapped to a CMR field related to an EJB
having a compound PK, the implementation is still read-only.
Revision Changes Path
1.5 +8 -6
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetomany/OneToManyTest.java
Index: OneToManyTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetomany/OneToManyTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- OneToManyTest.java 17 May 2005 15:49:38 -0000 1.4
+++ OneToManyTest.java 9 Jul 2005 13:33:38 -0000 1.5
@@ -306,11 +306,12 @@
TransactionContext ctx = newTransactionContext();
BLocal b = bhome.findByPrimaryKey(new Integer(11));
- try {
- b.setField3(new Integer(13));
- fail("Cannot set the value of a CMP field mapped to a foreign
key column.");
- } catch (EJBException e) {
- }
+ b.setField3(new Integer(2));
+
+ ALocal a = b.getA();
+ assertEquals(new Integer(2), a.getField1());
+ assertEquals("value2", a.getField2());
+
ctx.commit();
}
@@ -338,6 +339,7 @@
s.execute("CREATE TABLE B(B1 INTEGER, B2 VARCHAR(50), FKA1
INTEGER)");
s.execute("INSERT INTO A(A1, A2) VALUES(1, 'value1')");
+ s.execute("INSERT INTO A(A1, A2) VALUES(2, 'value2')");
s.execute("INSERT INTO B(B1, B2, FKA1) VALUES(11, 'value11', 1)");
s.execute("INSERT INTO B(B1, B2, FKA1) VALUES(22, 'value22', 1)");
s.close();