Examples of OneToMany


Examples of org.hibernate.mapping.OneToMany

    Iterator joinColumnsIt = collection.getKey().getColumnIterator();
    Set joinColumns = new HashSet();
    while ( joinColumnsIt.hasNext() ) {
      joinColumns.add( joinColumnsIt.next() );
    }
    OneToMany oneToMany = (OneToMany) collection.getElement();
    PersistentClass pc = cfg.getClassMapping( oneToMany.getReferencedEntityName() );
    Iterator properties = pc.getPropertyClosureIterator();
    //TODO we should check the table too
    boolean isOtherSide = false;
    mappedBy = "unresolved";
    while ( ! isOtherSide && properties.hasNext() ) {
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

Examples of org.hibernate.mapping.OneToMany

      collection.setExtraLazy(true);
    }

    Element oneToManyNode = node.element( "one-to-many" );
    if ( oneToManyNode != null ) {
      OneToMany oneToMany = new OneToMany( mappings, 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() );

      if ( LOG.isDebugEnabled() ) {
        LOG.debugf( "Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName() );
      }
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

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

Examples of org.hibernate.mapping.OneToMany

    }

    private String getMappedBy(Collection collectionValue) {
        PersistentClass referencedClass = null;
        if (collectionValue.getElement() instanceof OneToMany) {
            OneToMany oneToManyValue = (OneToMany) collectionValue.getElement();
            referencedClass = oneToManyValue.getAssociatedClass();
        } else if (collectionValue.getElement() instanceof ManyToOne) {
            // Case for bi-directional relation with @JoinTable on the owning @ManyToOne side.
            ManyToOne manyToOneValue = (ManyToOne) collectionValue.getElement();
            referencedClass = manyToOneValue.getMappings().getClass(manyToOneValue.getReferencedEntityName());
        }
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.