Package org.hibernate.ogm.model.key.spi

Examples of org.hibernate.ogm.model.key.spi.AssociatedEntityKeyMetadata


    // given
    String[] columnNames = { "foo", "bar", "baz" };
    AssociationKeyMetadata keyMetadata = new AssociationKeyMetadata.Builder()
        .table( "Foobar" )
        .columnNames( columnNames )
        .associatedEntityKeyMetadata( new AssociatedEntityKeyMetadata( null, null ) )
        .build();
    Object[] values = { 123, "Hello", 456L };

    AssociationKey key = new AssociationKey( keyMetadata, values, null );
View Full Code Here


  private AssociationKey createAssociationKey(EntityKey ownerEntityKey, String collectionRole, String tableName, String[] columnNames, Object[] columnValues, String[] rowKeyColumnNames) {
    AssociationKeyMetadata associationKeyMetadata = new AssociationKeyMetadata.Builder()
      .table( tableName )
      .columnNames( columnNames )
      .rowKeyColumnNames( rowKeyColumnNames )
      .associatedEntityKeyMetadata( new AssociatedEntityKeyMetadata( EMPTY_STRING_ARRAY, null ) )
      .inverse( false )
      .collectionRole( collectionRole )
      .associationKind( AssociationKind.ASSOCIATION )
      .oneToOne( false )
      .build();
View Full Code Here

    this.addExtraColumn();
    AssociationKeyMetadata metadata = new AssociationKeyMetadata.Builder()
        .table( "Project_Module" )
        .columnNames( new String[] { "Project_id" } )
        .rowKeyColumnNames( new String[] { "Project_id", "module_id" } )
        .associatedEntityKeyMetadata( new AssociatedEntityKeyMetadata( new String[] { "module_id" }, new EntityKeyMetadata( "Module", new String[] { "id" } ) ) )
        .inverse( false )
        .collectionRole( "modules" )
        .associationKind( AssociationKind.ASSOCIATION )
        .oneToOne( false )
        .build();

    AssociationKey associationKey = new AssociationKey(
        metadata,
        new Object[] { "projectID" },
        new EntityKey(
            new EntityKeyMetadata( "Project", new String[] { "id" } ),
            new String[] { "projectID" }
        )
    );

    AssociationContext associationContext = new AssociationContextImpl(
        new AssociationTypeContextImpl(
            OptionsContextImpl.forProperty(
                OptionValueSources.getDefaultSources( new ConfigurationPropertyReader( sessions.getProperties(), new ClassLoaderServiceImpl() ) ),
                Project.class,
                "modules"
            ),
            new AssociatedEntityKeyMetadata( null, null ),
            null
        ),
        new Tuple( new MongoDBTupleSnapshot( null, null, null ) )
    );
View Full Code Here

    associationKeyMetadata = new AssociationKeyMetadata.Builder()
        .table( getTableName() )
        .columnNames( getKeyColumnNames() )
        .rowKeyColumnNames( rowKeyColumnNames )
        .rowKeyIndexColumnNames( rowKeyIndexColumnNames )
        .associatedEntityKeyMetadata( new AssociatedEntityKeyMetadata( getElementColumnNames(), targetEntityKeyMetadata( false ) ) )
        .inverse( isInverse )
        .collectionRole( getUnqualifiedRole() )
        .associationKind( getElementType().isEntityType() ? AssociationKind.ASSOCIATION : AssociationKind.EMBEDDED_COLLECTION )
        .oneToOne( false )
        .build();
View Full Code Here

      if ( inverseOneToOneProperty != null ) {
        AssociationKeyMetadata metadata = new AssociationKeyMetadata.Builder()
            .table( getTableName() )
            .columnNames( propertyColumnNames )
            .rowKeyColumnNames( rowKeyColumnNames )
            .associatedEntityKeyMetadata( new AssociatedEntityKeyMetadata( entityKeyMetadata.getColumnNames(), entityKeyMetadata ) )
            .inverse( true )
            .collectionRole( inverseOneToOneProperty )
            .associationKind( AssociationKind.ASSOCIATION )
            .oneToOne( true )
            .build();
View Full Code Here

      if ( uniqueKeyType.isEntityType() ) {
        OgmEntityPersister associatedJoinable = (OgmEntityPersister) getFactory().getEntityPersister(
            ( (EntityType) uniqueKeyType ).getAssociatedEntityName() );

        for ( String column : getPropertyColumnNames( index ) ) {
          associatedEntityKeyMetadata.put( column, new AssociatedEntityKeyMetadata( getPropertyColumnNames( index ), associatedJoinable.getEntityKeyMetadata() ) );
          roles.put( column, getPropertyNames()[index] );
        }
      }
    }
View Full Code Here

            getTableName(),
            propertyColumnNames,
            rowKeyColumnNames,
            // Because it is an association to one entity it should not need an index column
            ArrayHelper.EMPTY_STRING_ARRAY,
            new AssociatedEntityKeyMetadata(
                entityKeyMetadata.getColumnNames(),
                entityKeyMetadata
            ),
            true,
            inverseOneToOneProperty,
View Full Code Here

      if ( uniqueKeyType.isEntityType() ) {
        OgmEntityPersister associatedJoinable = (OgmEntityPersister) getFactory().getEntityPersister(
            ( (EntityType) uniqueKeyType ).getAssociatedEntityName() );

        for ( String column : getPropertyColumnNames( index ) ) {
          associatedEntityKeyMetadata.put( column, new AssociatedEntityKeyMetadata( getPropertyColumnNames( index ), associatedJoinable.getEntityKeyMetadata() ) );
          roles.put( column, getPropertyNames()[index] );
        }
      }
    }
View Full Code Here

    associationKeyMetadata = new AssociationKeyMetadata(
        getTableName(),
        getKeyColumnNames(),
        rowKeyColumnNames,
        rowKeyIndexColumnNames,
        new AssociatedEntityKeyMetadata(
          getElementColumnNames(),
          targetEntityKeyMetadata( false )
        ),
        isInverse,
        getUnqualifiedRole(),
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.model.key.spi.AssociatedEntityKeyMetadata

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.