Examples of OneInverseSideLocal


Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

    public void testOneToManySetCMROnOwningSideResetPK() throws Exception {
        beginTransaction();
        try {

            OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            ManyOwningSideLocal owningLocal = createManyOwningSide(compoundPK_20_20, compoundPK_20_20_field1);
            owningLocal.setOneInverseSide(inverseLocal);
// todo should fail when we have fk as part of pk
//            Assert.fail();
            completeTransaction();
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

    public void testOneToManySetCMROnInverseSide() throws Exception {
        beginTransaction();
        try {

            OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            ManyOwningSideLocal owningLocal = createManyOwningSide(compoundPK_20_10, compoundPK_20_10_field1);
            inverseLocal.setManyOwningSide(Collections.singleton(owningLocal));
            completeTransaction();

            validateOneToManyRelationship();
        } catch (Throwable e) {
            e.printStackTrace();
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

    public void testOneToManySetCMROnInverseSideResetPK() throws Exception {
        beginTransaction();
        try {

            OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            ManyOwningSideLocal owningLocal = createManyOwningSide(compoundPK_20_20, compoundPK_20_20_field1);
            inverseLocal.setManyOwningSide(Collections.singleton(owningLocal));
// todo should fail when we have fk as part of pk
//            Assert.fail();
            completeTransaction();
        } catch (TransactionRolledbackLocalException e) {
            if (!(e.getCause() instanceof IllegalStateException)) {
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

        }
    }

    private OneInverseSideLocal createOneInverseSide(Integer id) throws Exception {
        OneInverseSideLocalHome home = oneInverseHome;
        OneInverseSideLocal oneInverseSideLocal = home.create(id);
        oneInverseCreated.add(id);
        return oneInverseSideLocal;
    }
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

        return home.findByPrimaryKey(id);
    }

    private void validateOneToOneRelationship() throws Exception {
        try {
            OneInverseSideLocal inverseLocal = findOneInverseSide(compoundPK_20_10_field1);

            OneOwningSideLocal oneOwningSide = inverseLocal.getOneOwningSide();
            Assert.assertNotNull(oneOwningSide);
            Assert.assertEquals(compoundPK_20_10, oneOwningSide.getPrimaryKey());

            OneInverseSideLocal inverseBackRef = oneOwningSide.getOneInverseSide();
            Assert.assertNotNull(inverseBackRef);
            Assert.assertEquals(compoundPK_20_10_field1, inverseBackRef.getPrimaryKey());
            completeTransaction();
        } finally {
            completeTransaction();
        }
    }
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

        return home.findByPrimaryKey(id);
    }

    private void validateOneToManyRelationship() throws NotSupportedException, SystemException, Exception, HeuristicMixedException, HeuristicRollbackException, RollbackException {
        try {
            OneInverseSideLocal inverseLocal = findOneInverseSide(compoundPK_20_10_field1);


            // verify one side has a set containing the many bean
            Set set = inverseLocal.getManyOwningSide();
            Assert.assertEquals(1, set.size());
            ManyOwningSideLocal owningLocal = (ManyOwningSideLocal) set.iterator().next();
            Assert.assertEquals(compoundPK_20_10, owningLocal.getPrimaryKey());

            // verify the many bean has a back reference to the one
            OneInverseSideLocal oneInverseSide = owningLocal.getOneInverseSide();
            Assert.assertNotNull(oneInverseSide);
            Assert.assertEquals(compoundPK_20_10_field1, oneInverseSide.getPrimaryKey());

            completeTransaction();
        } finally {
            completeTransaction();
        }
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

    public void testOneToOneSetCMROnOwningSide() throws Exception {
        beginTransaction();
        try {

            OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            OneOwningSideLocal owningLocal = createOneOwningSide(compoundPK_20_10, compoundPK_20_10_field1);
            owningLocal.setOneInverseSide(inverseLocal);
            completeTransaction();

            validateOneToOneRelationship();
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

    public void testOneToOneSetCMROnOwningSideResetPK() throws Exception {
        beginTransaction();
        try {

            OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            OneOwningSideLocal owningLocal = createOneOwningSide(compoundPK_20_20, compoundPK_20_20_field1);
            owningLocal.setOneInverseSide(inverseLocal);
// todo should fail when we have fk as part of pk
//            Assert.fail();
            completeTransaction();
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

    public void testOneToOneSetCMROnInverseSide() throws Exception {
        beginTransaction();
        try {

            OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            OneOwningSideLocal owningLocal = createOneOwningSide(compoundPK_20_10, compoundPK_20_10_field1);
            inverseLocal.setOneOwningSide(owningLocal);
            completeTransaction();

            validateOneToOneRelationship();
        } catch (Throwable e) {
            e.printStackTrace();
View Full Code Here

Examples of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

    public void testOneToOneSetCMROnInverseSideResetPK() throws Exception {
        beginTransaction();
        try {

            OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            OneOwningSideLocal owningLocal = createOneOwningSide(compoundPK_20_20, compoundPK_20_20_field1);
            inverseLocal.setOneOwningSide(owningLocal);
// todo should fail when we have fk as part of pk
//            Assert.fail();
            completeTransaction();
        } catch (TransactionRolledbackLocalException e) {
            if (!(e.getCause() instanceof IllegalStateException)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.