Package org.apache.openejb.test.entity.cmr.cmrmapping

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


        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

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

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

            validateOneToOneRelationship();
View Full Code Here

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

            final OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            final 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

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

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

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

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

            final OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            final 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 (final TransactionRolledbackLocalException e) {
            if (!(e.getCause() instanceof IllegalStateException)) {
View Full Code Here

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

            final OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            final ManyOwningSideLocal owningLocal = createManyOwningSide(compoundPK_20_10, compoundPK_20_10_field1);
            owningLocal.setOneInverseSide(inverseLocal);
            completeTransaction();

            validateOneToManyRelationship();
View Full Code Here

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

            final OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            final ManyOwningSideLocal owningLocal = createManyOwningSide(compoundPK_20_10, compoundPK_20_10_field1);
            owningLocal.setOneInverseSide(inverseLocal);
            completeTransaction();

            owningLocal.testEJBSelect();
View Full Code Here

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

            final OneInverseSideLocal inverseLocal = createOneInverseSide(compoundPK_20_10_field1);
            final 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

    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();
View Full Code Here

TOP

Related Classes of org.apache.openejb.test.entity.cmr.cmrmapping.OneInverseSideLocal

Copyright © 2018 www.massapicom. 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.