Package org.hibernate.mapping

Examples of org.hibernate.mapping.KeyValue


  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

    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

    cfg.buildMappings();
    PersistentClass classMapping = cfg.getClassMapping(toClassName("orders") );
   
    assertNotNull("class not found", classMapping);   
   
    KeyValue identifier = classMapping.getIdentifier();
   
    assertNotNull(identifier);
   
  }
View Full Code Here

    cfg.buildMappings();
    PersistentClass classMapping = cfg.getClassMapping(toClassName("item") );
   
    assertNotNull(classMapping);   
   
    KeyValue identifier = classMapping.getIdentifier();
   
    assertNotNull(identifier)
   
    assertEquals(3,classMapping.getPropertyClosureSpan() );
   
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.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

    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

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.