Search in sources :

Example 26 with PlatformLocal

use of org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal in project tomee by apache.

the class ManyToManyComplexPkTests method testBSetAExistingANewB.

public void testBSetAExistingANewB() throws Exception {
    resetDB();
    beginTransaction();
    try {
        final PlatformLocal platform = findPlatform(new Integer(1));
        final GameLocal game = createGame(new Integer(33));
        final Set<PlatformLocal> platformSets = game.getPlatforms();
        platformSets.add(platform);
    } finally {
        completeTransaction();
    }
    assertLinked(1, 33);
}
Also used : GameLocal(org.apache.openejb.test.entity.cmr.manytomany.GameLocal) PlatformLocal(org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal)

Example 27 with PlatformLocal

use of org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal in project tomee by apache.

the class ManyToManyTests method testBSetANewAB.

public void testBSetANewAB() throws Exception {
    resetDB();
    beginTransaction();
    try {
        final PlatformLocal platform = createPlatform(new Integer(4));
        final GameLocal game = createGame(new Integer(33));
        final Set<PlatformLocal> platformSets = game.getPlatforms();
        platformSets.add(platform);
    } finally {
        completeTransaction();
    }
    assertLinked(4, 33);
}
Also used : GameLocal(org.apache.openejb.test.entity.cmr.manytomany.GameLocal) PlatformLocal(org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal)

Example 28 with PlatformLocal

use of org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal in project tomee by apache.

the class ManyToManyTests method testBSetAExistingBNewA.

public void testBSetAExistingBNewA() throws Exception {
    resetDB();
    beginTransaction();
    try {
        final PlatformLocal platform = createPlatform(new Integer(4));
        final GameLocal game = findGame(new Integer(11));
        final Set<PlatformLocal> platformSets = game.getPlatforms();
        platformSets.add(platform);
    } finally {
        completeTransaction();
    }
    assertLinked(4, 11);
}
Also used : GameLocal(org.apache.openejb.test.entity.cmr.manytomany.GameLocal) PlatformLocal(org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal)

Example 29 with PlatformLocal

use of org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal in project tomee by apache.

the class ManyToManyTests method testASetBDropExisting.

public void testASetBDropExisting() throws Exception {
    resetDB();
    beginTransaction();
    try {
        PlatformLocal platform = findPlatform(new Integer(1));
        platform.setGames(new HashSet<GameLocal>());
        platform = findPlatform(new Integer(2));
        platform.setGames(new HashSet<GameLocal>());
        platform = findPlatform(new Integer(3));
        platform.setGames(new HashSet<GameLocal>());
    } finally {
        completeTransaction();
    }
    assertAllUnlinked();
}
Also used : GameLocal(org.apache.openejb.test.entity.cmr.manytomany.GameLocal) PlatformLocal(org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal)

Example 30 with PlatformLocal

use of org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal in project tomee by apache.

the class ManyToManyTests method testRemoveRelationships.

public void testRemoveRelationships() throws Exception {
    resetDB();
    beginTransaction();
    try {
        final PlatformLocal platform = findPlatform(new Integer(1));
        platform.remove();
    } finally {
        completeTransaction();
    }
    assertPlatformDeleted(1);
}
Also used : PlatformLocal(org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal)

Aggregations

PlatformLocal (org.apache.openejb.test.entity.cmr.manytomany.PlatformLocal)37 GameLocal (org.apache.openejb.test.entity.cmr.manytomany.GameLocal)30 ResultSet (java.sql.ResultSet)12 HashSet (java.util.HashSet)12 Iterator (java.util.Iterator)12 Set (java.util.Set)12 ConcurrentModificationException (java.util.ConcurrentModificationException)8 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 TransactionRolledbackLocalException (javax.ejb.TransactionRolledbackLocalException)2