Examples of OneToMany


Examples of org.apache.camel.dataformat.bindy.annotation.OneToMany

                    list.add(result);
                }

            }

            OneToMany oneToMany = field.getAnnotation(OneToMany.class);
            if (oneToMany != null) {

                // Set global variable
                // Will be used during generation of CSV
                isOneToMany = true;
View Full Code Here

Examples of org.apache.deltaspike.data.test.domain.OneToMany

        final String name = "testCreateJoinCriteriaQuery";
        final String nameOne = name + "-one";
        final String nameMany = name + "-many";
        Parent parent = new Parent(name);
        parent.setOne(new OneToOne(nameOne));
        parent.add(new OneToMany(nameMany));

        entityManager.persist(parent);
        entityManager.flush();

        // when
View Full Code Here

Examples of org.apache.deltaspike.data.test.domain.OneToMany

    public void should_create_fetch_query()
    {
        // given
        final String name = "testCreateFetchQuery";
        Parent parent = new Parent(name);
        parent.add(new OneToMany(name + "-1"));
        parent.add(new OneToMany(name + "-2"));

        entityManager.persist(parent);
        entityManager.flush();

        // when
View Full Code Here

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

Examples of org.chromattic.api.annotations.OneToMany

      }
    }

    // One to many
    for (PropertyInfo propertyInfo : info.getProperties(OneToMany.class)) {
      OneToMany oneToManyAnn = propertyInfo.getAnnotation(OneToMany.class);
      if (propertyInfo instanceof MultiValuedPropertyInfo) {
        MultiValuedPropertyInfo multiValuedProperty = (MultiValuedPropertyInfo)propertyInfo;

        //
        if (multiValuedProperty instanceof MapPropertyInfo) {
          MapPropertyInfo mapProperty = (MapPropertyInfo)multiValuedProperty;
          if (!(mapProperty.getKeyValue() instanceof SimpleValueInfo)) {
            throw new IllegalStateException("Wrong key value type " + mapProperty.getKeyValue());
          }
          SimpleValueInfo svi = (SimpleValueInfo)mapProperty.getKeyValue();
          if (svi.getSimpleType() != SimpleType.STRING) {
            throw new IllegalStateException();
          }
        }

        //
        ValueInfo beanElementType = multiValuedProperty.getElementValue();
        if (beanElementType instanceof BeanValueInfo) {
          BeanValueInfo bvi = (BeanValueInfo)beanElementType;

          //
          OneToManyMapping mapping;
          RelationshipType type = oneToManyAnn.type();
          if (type == RelationshipType.HIERARCHIC) {
            MappedBy mappedBy = propertyInfo.getAnnotation(MappedBy.class);
            if (mappedBy != null) {
              throw new IllegalStateException();
            }
View Full Code Here

Examples of org.exolab.castor.xml.schema.annotations.jdo.OneToMany

        appInfos = annotation.getAppInfo();
        appInfo = (AppInfo) appInfos.nextElement();
        jdoContent = appInfo.getJdoContent();

        assertEquals(1, jdoContent.size());
        OneToMany oneToMany = (OneToMany) jdoContent.get(0);
        assertEquals("author_id", oneToMany.getName());
        assertTrue(oneToMany.isReadOnly());
        assertTrue(oneToMany.isDirty());
    }
View Full Code Here

Examples of org.hibernate.mapping.OneToMany

      collection.setElement( element );

        } else {
          String tableToClassName = bindCollection( rc, foreignKey, null, collection );

          OneToMany oneToMany = new OneToMany( collection.getOwner() );

      oneToMany.setReferencedEntityName( tableToClassName ); // Child
          mappings.addSecondPass( new JDBCCollectionSecondPass(mappings, collection) );

          collection.setElement(oneToMany);
        }
    // bind keyvalue
View Full Code Here

Examples of org.hibernate.mapping.OneToMany

            java.util.Map persistentClasses,
            Mappings mappings,
            java.util.Map inheritedMetas) throws MappingException {

        if(collection.isOneToMany() ) {
            OneToMany oneToMany = (OneToMany) collection.getElement();
            PersistentClass persistentClass = mappings.getClass(oneToMany.getReferencedEntityName() );

            if (persistentClass==null) throw new MappingException(
                    "Association " + collection.getRole() + " references unmapped class: " + oneToMany.getReferencedEntityName()
                );

            oneToMany.setAssociatedClass(persistentClass); // Child
        }

    }
View Full Code Here

Examples of org.hibernate.mapping.OneToMany

      collection.setExtraLazy(true);
    }

    Element oneToManyNode = node.element( "one-to-many" );
    if ( oneToManyNode != null ) {
      OneToMany oneToMany = new OneToMany( collection.getOwner() );
      collection.setElement( oneToMany );
      bindOneToMany( oneToManyNode, oneToMany, mappings );
      // we have to set up the table later!! yuck
    }
    else {
View Full Code Here

Examples of org.hibernate.mapping.OneToMany

  public static void bindCollectionSecondPass(Element node, Collection collection,
      java.util.Map persistentClasses, Mappings mappings, java.util.Map inheritedMetas)
      throws MappingException {

    if ( collection.isOneToMany() ) {
      OneToMany oneToMany = (OneToMany) collection.getElement();
      String assocClass = oneToMany.getReferencedEntityName();
      PersistentClass persistentClass = (PersistentClass) persistentClasses.get( assocClass );
      if ( persistentClass == null ) {
        throw new MappingException( "Association references unmapped class: " + assocClass );
      }
      oneToMany.setAssociatedClass( persistentClass );
      collection.setCollectionTable( persistentClass.getTable() );

      log.info(
          "Mapping collection: " + collection.getRole() +
          " -> " + collection.getCollectionTable().getName()
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.