Search in sources :

Example 6 with ManyOwningSideLocal

use of org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideLocal in project tomee by apache.

the class CmrMappingTests method createManyOwningSide.

private ManyOwningSideLocal createManyOwningSide(final Integer id, final Integer field1) throws Exception {
    final ManyOwningSideLocalHome home = manyHome;
    final ManyOwningSideLocal manyOwningSideLocal = home.create(id, field1);
    manyCreated.add(id);
    return manyOwningSideLocal;
}
Also used : ManyOwningSideLocal(org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideLocal) ManyOwningSideLocalHome(org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideLocalHome)

Example 7 with ManyOwningSideLocal

use of org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideLocal in project tomee by apache.

the class CmrMappingTests method testOneToManySetCMROnInverseSide.

public void testOneToManySetCMROnInverseSide() throws Exception {
    beginTransaction();
    try {
        final OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
        final ManyOwningSideLocal owningLocal = createManyOwningSide(compoundPK_20_10, compoundPK_20_10_field1);
        inverseLocal.setManyOwningSide(Collections.singleton(owningLocal));
        completeTransaction();
        validateOneToManyRelationship();
    } catch (final Throwable e) {
        e.printStackTrace();
        throw new TestFailureException(new AssertionFailedError("Received Exception " + e.getClass() + " : " + e.getMessage()));
    } finally {
        completeTransaction();
        cleanDb();
    }
}
Also used : OneInverseSideLocal(org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal) TestFailureException(org.apache.openejb.test.TestFailureException) ManyOwningSideLocal(org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideLocal) AssertionFailedError(junit.framework.AssertionFailedError)

Aggregations

ManyOwningSideLocal (org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideLocal)7 OneInverseSideLocal (org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal)6 AssertionFailedError (junit.framework.AssertionFailedError)5 TestFailureException (org.apache.openejb.test.TestFailureException)5 TransactionRolledbackLocalException (javax.ejb.TransactionRolledbackLocalException)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 ManyOwningSideLocalHome (org.apache.openejb.test.entity.cmr.cmrmapping.ManyOwningSideLocalHome)1