gdamour 2004/11/11 08:27:44
Modified:
modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/manytomany
ManyToManyCompoundPKTest.java ManyToManyTest.java
Log:
GERONIMO-467: ejbRemove does not work for CMP with MTM relationship
GERONIMO-468: CMP - cascade delete is not supported
o update CMPRemoveMethod such that relationships are reset and EJB in
cascade-delete relationships are also removed; and
o update the way the various TranQL schema are built in order to retrieve
the EJB defining a cascade-delete relationship.
Revision Changes Path
1.2 +17 -1
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/manytomany/ManyToManyCompoundPKTest.java
Index: ManyToManyCompoundPKTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/manytomany/ManyToManyCompoundPKTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ManyToManyCompoundPKTest.java 10 Nov 2004 01:35:11 -0000 1.1
+++ ManyToManyCompoundPKTest.java 11 Nov 2004 13:27:44 -0000 1.2
@@ -276,6 +276,22 @@
assertStateExistingANewB();
}
+ public void testRemoveRelationships() throws Exception {
+ ContainerTransactionContext ctx = newTransactionContext();
+ ALocal a = ahome.findByPrimaryKey(new CompoundPK(new Integer(1),
"value1"));
+ a.remove();
+ ctx.commit();
+
+ Connection c = ds.getConnection();
+ Statement s = c.createStatement();
+ ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM MTM WHERE fka1 =
1 AND fka2 = 'value1'");
+ assertTrue(rs.next());
+ assertEquals(0, rs.getInt(1));
+ rs.close();
+ s.close();
+ c.close();
+ }
+
protected void setUp() throws Exception {
super.setUp();
1.2 +17 -1
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/manytomany/ManyToManyTest.java
Index: ManyToManyTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/manytomany/ManyToManyTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ManyToManyTest.java 10 Nov 2004 01:35:11 -0000 1.1
+++ ManyToManyTest.java 11 Nov 2004 13:27:44 -0000 1.2
@@ -271,6 +271,22 @@
assertStateExistingANewB();
}
+ public void testRemoveRelationships() throws Exception {
+ ContainerTransactionContext ctx = newTransactionContext();
+ ALocal a = ahome.findByPrimaryKey(new Integer(1));
+ a.remove();
+ ctx.commit();
+
+ Connection c = ds.getConnection();
+ Statement s = c.createStatement();
+ ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM MTM WHERE fka1 =
1");
+ assertTrue(rs.next());
+ assertEquals(0, rs.getInt(1));
+ rs.close();
+ s.close();
+ c.close();
+ }
+
protected void setUp() throws Exception {
super.setUp();