Package org.hibernate.mapping

Examples of org.hibernate.mapping.KeyValue


  private static SimpleValue buildCollectionKey(
      Collection collValue, Ejb3JoinColumn[] joinColumns, boolean cascadeDeleteEnabled,
      XProperty property, Mappings mappings
  ) {
    //binding key reference using column
    KeyValue keyVal;
    //give a chance to override the referenced property name
    //has to do that here because the referencedProperty creation happens in a FKSecondPass for Many to one yuk!
    if ( joinColumns.length > 0 && StringHelper.isNotEmpty( joinColumns[0].getMappedBy() ) ) {
      String entityName = joinColumns[0].getManyToManyOwnerSideEntityName() != null ?
          "inverse__" + joinColumns[0].getManyToManyOwnerSideEntityName() :
View Full Code Here


        mappedByColumns = ( (Collection) property.getValue() ).getKey().getColumnIterator();
      }
      else {
        //find the appropriate reference key, can be in a join
        Iterator joinsIt = referencedEntity.getJoinIterator();
        KeyValue key = null;
        while ( joinsIt.hasNext() ) {
          Join join = (Join) joinsIt.next();
          if ( join.containsProperty( property ) ) {
            key = join.getKey();
            break;
          }
        }
        if ( key == null ) key = property.getPersistentClass().getIdentifier();
        mappedByColumns = key.getColumnIterator();
      }
      while ( mappedByColumns.hasNext() ) {
        Column column = (Column) mappedByColumns.next();
        columns[0].linkValueUsingAColumnCopy( column, value );
      }
View Full Code Here

    }
    else {
      //try the embedded property
      //embedded property starts their path with 'id.' See PropertyPreloadedData( ) use when idClass != null in AnnotationBinder
      if ( path.startsWith( "id." ) ) {
        KeyValue valueIdentifier = persistentClass.getIdentifier();
        String localPath = path.substring( 3 );
        if ( valueIdentifier instanceof Component ) {
          Iterator it = ( (Component) valueIdentifier ).getPropertyIterator();
          while ( it.hasNext() ) {
            Property idProperty = (Property) it.next();
View Full Code Here

  private static SimpleValue buildCollectionKey(
      Collection collValue, Ejb3JoinColumn[] joinColumns, boolean cascadeDeleteEnabled,
      XProperty property, ExtendedMappings mappings
  ) {
    //binding key reference using column
    KeyValue keyVal;
    //give a chance to override the referenced property name
    //has to do that here because the referencedProperty creation happens in a FKSecondPass for Many to one yuk!
    if ( joinColumns.length > 0 && StringHelper.isNotEmpty( joinColumns[0].getMappedBy() ) ) {
      String entityName = joinColumns[0].getManyToManyOwnerSideEntityName() != null ?
          "inverse__" + joinColumns[0].getManyToManyOwnerSideEntityName() :
View Full Code Here

        mappedByColumns = ( (Collection) property.getValue() ).getKey().getColumnIterator();
      }
      else {
        //find the appropriate reference key, can be in a join
        Iterator joinsIt = referencedEntity.getJoinIterator();
        KeyValue key = null;
        while ( joinsIt.hasNext() ) {
          Join join = (Join) joinsIt.next();
          if ( join.containsProperty( property ) ) {
            key = join.getKey();
            break;
          }
        }
        if ( key == null ) key = property.getPersistentClass().getIdentifier();
        mappedByColumns = key.getColumnIterator();
      }
      while ( mappedByColumns.hasNext() ) {
        Column column = (Column) mappedByColumns.next();
        columns[0].linkValueUsingAColumnCopy( column, value );
      }
View Full Code Here

    final String propertyName = inferredData.getPropertyName();
    log.trace( "Fetching {} with {}", propertyName, fetchMode );
    boolean mapToPK = true;
    if ( !trueOneToOne ) {
      //try to find a hidden true one to one (FK == PK columns)
      KeyValue identifier = propertyHolder.getIdentifier();
      if ( identifier == null ) {
        //this is a @OneToOne in a @EmbeddedId (the persistentClass.identifier is not set yet, it's being built)
        //by definition the PK cannot refers to itself so it cannot map to itself
        mapToPK = false;
      }
      else {
        Iterator idColumns = identifier.getColumnIterator();
        List<String> idColumnNames = new ArrayList<String>();
        org.hibernate.mapping.Column currentColumn;
        if ( identifier.getColumnSpan() !=  joinColumns.length ) {
          mapToPK = false;
        }
        else {
          while ( idColumns.hasNext() ) {
            currentColumn = (org.hibernate.mapping.Column) idColumns.next();
View Full Code Here

    while ( iter.hasNext() ) {
      Element subnode = (Element) iter.next();
      String name = subnode.getName();

      if ( "key".equals( name ) ) {
        KeyValue keyVal;
        String propRef = collection.getReferencedPropertyName();
        if ( propRef == null ) {
          keyVal = collection.getOwner().getIdentifier();
        }
        else {
View Full Code Here

    final String propertyName = inferredData.getPropertyName();
    LOG.tracev( "Fetching {0} with {1}", propertyName, fetchMode );
    boolean mapToPK = true;
    if ( !trueOneToOne ) {
      //try to find a hidden true one to one (FK == PK columns)
      KeyValue identifier = propertyHolder.getIdentifier();
      if ( identifier == null ) {
        //this is a @OneToOne in a @EmbeddedId (the persistentClass.identifier is not set yet, it's being built)
        //by definition the PK cannot refers to itself so it cannot map to itself
        mapToPK = false;
      }
      else {
        Iterator idColumns = identifier.getColumnIterator();
        List<String> idColumnNames = new ArrayList<String>();
        org.hibernate.mapping.Column currentColumn;
        if ( identifier.getColumnSpan() != joinColumns.length ) {
          mapToPK = false;
        }
        else {
          while ( idColumns.hasNext() ) {
            currentColumn = ( org.hibernate.mapping.Column ) idColumns.next();
View Full Code Here

  private static SimpleValue buildCollectionKey(
      Collection collValue, Ejb3JoinColumn[] joinColumns, boolean cascadeDeleteEnabled,
      XProperty property, Mappings mappings
  ) {
    //binding key reference using column
    KeyValue keyVal;
    //give a chance to override the referenced property name
    //has to do that here because the referencedProperty creation happens in a FKSecondPass for Many to one yuk!
    if ( joinColumns.length > 0 && StringHelper.isNotEmpty( joinColumns[0].getMappedBy() ) ) {
      String entityName = joinColumns[0].getManyToManyOwnerSideEntityName() != null ?
          "inverse__" + joinColumns[0].getManyToManyOwnerSideEntityName() :
View Full Code Here

        mappedByColumns = ( (Collection) property.getValue() ).getKey().getColumnIterator();
      }
      else {
        //find the appropriate reference key, can be in a join
        Iterator joinsIt = referencedEntity.getJoinIterator();
        KeyValue key = null;
        while ( joinsIt.hasNext() ) {
          Join join = (Join) joinsIt.next();
          if ( join.containsProperty( property ) ) {
            key = join.getKey();
            break;
          }
        }
        if ( key == null ) key = property.getPersistentClass().getIdentifier();
        mappedByColumns = key.getColumnIterator();
      }
      while ( mappedByColumns.hasNext() ) {
        Column column = (Column) mappedByColumns.next();
        columns[0].linkValueUsingAColumnCopy( column, value );
      }
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.KeyValue

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.