Package org.apache.openejb.jee.jpa

Examples of org.apache.openejb.jee.jpa.OneToMany


                    //
                    // one-to-many
                    //

                    // left
                    OneToMany leftOneToMany = null;
                    leftOneToMany = new OneToMany();
                    leftOneToMany.setName(leftFieldName);
                    leftOneToMany.setSyntheticField(leftSynthetic);
                    leftOneToMany.setMappedBy(rightFieldName);
                    setCascade(rightRole, leftOneToMany);
                    leftEntity.getAttributes().getOneToMany().add(leftOneToMany);

                    // right
                    ManyToOne rightManyToOne = null;
                    rightManyToOne = new ManyToOne();
                    rightManyToOne.setName(rightFieldName);
                    rightManyToOne.setSyntheticField(rightSynthetic);
                    setCascade(leftRole, rightManyToOne);
                    rightEntity.getAttributes().getManyToOne().add(rightManyToOne);

                    // link
                    leftOneToMany.setRelatedField(rightManyToOne);
                    rightManyToOne.setRelatedField(leftOneToMany);
                } else if (!leftIsOne && rightIsOne) {
                    //
                    // many-to-one
                    //

                    // left
                    ManyToOne leftManyToOne = null;
                    leftManyToOne = new ManyToOne();
                    leftManyToOne.setName(leftFieldName);
                    leftManyToOne.setSyntheticField(leftSynthetic);
                    setCascade(rightRole, leftManyToOne);
                    leftEntity.getAttributes().getManyToOne().add(leftManyToOne);

                    // right
                    OneToMany rightOneToMany = null;
                    rightOneToMany = new OneToMany();
                    rightOneToMany.setName(rightFieldName);
                    rightOneToMany.setSyntheticField(rightSynthetic);
                    rightOneToMany.setMappedBy(leftFieldName);
                    setCascade(leftRole, rightOneToMany);
                    rightEntity.getAttributes().getOneToMany().add(rightOneToMany);

                    // link
                    leftManyToOne.setRelatedField(rightOneToMany);
                    rightOneToMany.setRelatedField(leftManyToOne);
                } else if (!leftIsOne && !rightIsOne) {
                    //
                    // many-to-many
                    //
View Full Code Here


                    //
                    // one-to-many
                    //

                    // left
                    OneToMany leftOneToMany = null;
                    leftOneToMany = new OneToMany();
                    leftOneToMany.setName(leftFieldName);
                    leftOneToMany.setSyntheticField(leftSynthetic);
                    leftOneToMany.setMappedBy(rightFieldName);
                    setCascade(rightRole, leftOneToMany);
                    leftEntity.getAttributes().getOneToMany().add(leftOneToMany);

                    // right
                    ManyToOne rightManyToOne = null;
                    rightManyToOne = new ManyToOne();
                    rightManyToOne.setName(rightFieldName);
                    rightManyToOne.setSyntheticField(rightSynthetic);
                    setCascade(leftRole, rightManyToOne);
                    rightEntity.getAttributes().getManyToOne().add(rightManyToOne);

                    // link
                    leftOneToMany.setRelatedField(rightManyToOne);
                    rightManyToOne.setRelatedField(leftOneToMany);
                } else if (!leftIsOne && rightIsOne) {
                    //
                    // many-to-one
                    //

                    // left
                    ManyToOne leftManyToOne = null;
                    leftManyToOne = new ManyToOne();
                    leftManyToOne.setName(leftFieldName);
                    leftManyToOne.setSyntheticField(leftSynthetic);
                    setCascade(rightRole, leftManyToOne);
                    leftEntity.getAttributes().getManyToOne().add(leftManyToOne);

                    // right
                    OneToMany rightOneToMany = null;
                    rightOneToMany = new OneToMany();
                    rightOneToMany.setName(rightFieldName);
                    rightOneToMany.setSyntheticField(rightSynthetic);
                    rightOneToMany.setMappedBy(leftFieldName);
                    setCascade(leftRole, rightOneToMany);
                    rightEntity.getAttributes().getOneToMany().add(rightOneToMany);

                    // link
                    leftManyToOne.setRelatedField(rightOneToMany);
                    rightOneToMany.setRelatedField(leftManyToOne);
                } else if (!leftIsOne && !rightIsOne) {
                    //
                    // many-to-many
                    //
View Full Code Here

            //
            // one-to-many
            //

            // left
            final OneToMany leftOneToMany;
            leftOneToMany = new OneToMany();
            leftOneToMany.setName(leftFieldName);
            leftOneToMany.setSyntheticField(leftSynthetic);
            leftOneToMany.setMappedBy(rightFieldName);
            setCascade(rightRole, leftOneToMany);
            addRelationship(leftOneToMany, leftRelationships, leftAttributes.getOneToMany());

            // right
            final ManyToOne rightManyToOne;
            rightManyToOne = new ManyToOne();
            rightManyToOne.setName(rightFieldName);
            rightManyToOne.setSyntheticField(rightSynthetic);
            setCascade(leftRole, rightManyToOne);
            addRelationship(rightManyToOne, rightRelationships, rightAttributes.getManyToOne());

            // link
            leftOneToMany.setRelatedField(rightManyToOne);
            rightManyToOne.setRelatedField(leftOneToMany);
        } else if (!leftIsOne && rightIsOne) {
            //
            // many-to-one
            //

            // left
            final ManyToOne leftManyToOne;
            leftManyToOne = new ManyToOne();
            leftManyToOne.setName(leftFieldName);
            leftManyToOne.setSyntheticField(leftSynthetic);
            setCascade(rightRole, leftManyToOne);
            addRelationship(leftManyToOne, leftRelationships, leftAttributes.getManyToOne());

            // right
            final OneToMany rightOneToMany;
            rightOneToMany = new OneToMany();
            rightOneToMany.setName(rightFieldName);
            rightOneToMany.setSyntheticField(rightSynthetic);
            rightOneToMany.setMappedBy(leftFieldName);
            setCascade(leftRole, rightOneToMany);
            addRelationship(rightOneToMany, rightRelationships, rightAttributes.getOneToMany());

            // link
            leftManyToOne.setRelatedField(rightOneToMany);
            rightOneToMany.setRelatedField(leftManyToOne);
        } else if (!leftIsOne && !rightIsOne) {
            //
            // many-to-many
            //
View Full Code Here

            //
            // one-to-many
            //

            // left
            OneToMany leftOneToMany = null;
            leftOneToMany = new OneToMany();
            leftOneToMany.setName(leftFieldName);
            leftOneToMany.setSyntheticField(leftSynthetic);
            leftOneToMany.setMappedBy(rightFieldName);
            setCascade(rightRole, leftOneToMany);
            addRelationship(leftOneToMany, leftRelationships, leftAttributes.getOneToMany());

            // right
            ManyToOne rightManyToOne = null;
            rightManyToOne = new ManyToOne();
            rightManyToOne.setName(rightFieldName);
            rightManyToOne.setSyntheticField(rightSynthetic);
            setCascade(leftRole, rightManyToOne);
            addRelationship(rightManyToOne, rightRelationships, rightAttributes.getManyToOne());

            // link
            leftOneToMany.setRelatedField(rightManyToOne);
            rightManyToOne.setRelatedField(leftOneToMany);
        } else if (!leftIsOne && rightIsOne) {
            //
            // many-to-one
            //

            // left
            ManyToOne leftManyToOne = null;
            leftManyToOne = new ManyToOne();
            leftManyToOne.setName(leftFieldName);
            leftManyToOne.setSyntheticField(leftSynthetic);
            setCascade(rightRole, leftManyToOne);
            addRelationship(leftManyToOne, leftRelationships, leftAttributes.getManyToOne());

            // right
            OneToMany rightOneToMany = null;
            rightOneToMany = new OneToMany();
            rightOneToMany.setName(rightFieldName);
            rightOneToMany.setSyntheticField(rightSynthetic);
            rightOneToMany.setMappedBy(leftFieldName);
            setCascade(leftRole, rightOneToMany);
            addRelationship(rightOneToMany, rightRelationships, rightAttributes.getOneToMany());

            // link
            leftManyToOne.setRelatedField(rightOneToMany);
            rightOneToMany.setRelatedField(leftManyToOne);
        } else if (!leftIsOne && !rightIsOne) {
            //
            // many-to-many
            //
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.jpa.OneToMany

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.