Examples of EntityReference


Examples of org.hibernate.loader.plan.spi.EntityReference

  @Override
  protected  void applyRootReturnSelectFragments(SelectStatementBuilder selectStatementBuilder) {
    if ( getQueryableCollection().hasIndex() &&
        getQueryableCollection().getIndexType().isEntityType() ) {
      final EntityReference indexEntityReference = getRootCollectionReturn().getIndexGraph().resolveEntityReference();
      final EntityReferenceAliases indexEntityReferenceAliases = getAliasResolutionContext().resolveEntityReferenceAliases(
          indexEntityReference.getQuerySpaceUid()
      );
      selectStatementBuilder.appendSelectClauseFragment(
          ( (OuterJoinLoadable) indexEntityReference.getEntityPersister() ).selectFragment(
              indexEntityReferenceAliases.getTableAlias(),
              indexEntityReferenceAliases.getColumnAliases().getSuffix()
          )
      );
    }
View Full Code Here

Examples of org.hibernate.loader.plan.spi.EntityReference

  private void resolveEntityKey(
      ResultSet resultSet,
      ResultSetProcessingContextImpl context,
      EntityReferenceInitializer entityReferenceInitializer,
      Map<EntityReference,EntityReferenceInitializer> initializerByEntityReference) throws SQLException {
    final EntityReference entityReference = entityReferenceInitializer.getEntityReference();
    final EntityIdentifierDescription identifierDescription = entityReference.getIdentifierDescription();

    if ( identifierDescription.hasFetches() || identifierDescription.hasBidirectionalEntityReferences() ) {
      resolveEntityKey( resultSet, context, (FetchSource) identifierDescription, initializerByEntityReference );
    }
    entityReferenceInitializer.resolveEntityKey( resultSet, context );
View Full Code Here

Examples of org.hibernate.loader.plan.spi.EntityReference

    // if the fetchSource is an entityReference, we should also walk its identifier fetches here...
    //
    // what if fetchSource is a composite fetch (as it would be in the case of a key-many-to-one)?
    if ( EntityReference.class.isInstance( fetchSource ) ) {
      final EntityReference fetchOwnerAsEntityReference = (EntityReference) fetchSource;
      if ( fetchOwnerAsEntityReference.getIdentifierDescription().hasFetches() ) {
        final FetchSource entityIdentifierAsFetchSource = (FetchSource) fetchOwnerAsEntityReference.getIdentifierDescription();
        for ( Fetch fetch : entityIdentifierAsFetchSource.getFetches() ) {
          processFetch(
              selectStatementBuilder,
              fetchSource,
              fetch,
View Full Code Here

Examples of org.hibernate.loader.plan2.spi.EntityReference

    // if the fetchSource is an entityReference, we should also walk its identifier fetches here...
    //
    // what if fetchSource is a composite fetch (as it would be in the case of a key-many-to-one)?
    if ( EntityReference.class.isInstance( fetchSource ) ) {
      final EntityReference fetchOwnerAsEntityReference = (EntityReference) fetchSource;
      if ( fetchOwnerAsEntityReference.getIdentifierDescription().hasFetches() ) {
        final FetchSource entityIdentifierAsFetchSource = (FetchSource) fetchOwnerAsEntityReference.getIdentifierDescription();
        for ( Fetch fetch : entityIdentifierAsFetchSource.getFetches() ) {
          processFetch(
              selectStatementBuilder,
              fetchSource,
              fetch,
View Full Code Here

Examples of org.qi4j.api.entity.EntityReference

                            try
                            {
                                JSONTokener tokener = new JSONTokener( item );
                                JSONObject entity = (JSONObject) tokener.nextValue();
                                String id = entity.getString( JSONKeys.identity.name() );
                                store.put( new EntityReference( id ), item );
                            }
                            catch( JSONException e )
                            {
                                throw new IOException( e );
                            }
View Full Code Here

Examples of org.qi4j.api.entity.EntityReference

                    Object result = oin.readObject();
                    oin.close();

                    if( result instanceof EntityReference )
                    {
                        EntityReference ref = (EntityReference) result;
                        if( !valueType.type().equals( EntityReference.class ) )
                        {
                            Class mixinType = valueType.type();
                            if (module.isUnitOfWorkActive())
                            {
                                UnitOfWork unitOfWork = module.currentUnitOfWork();
                                result = unitOfWork.get( mixinType, ref.identity() );
                            }
                        }
                    }

                    return result;
View Full Code Here

Examples of org.qi4j.api.entity.EntityReference

    {
        this.model = model;
        this.uow = uow;
        this.store = store;
        this.identity = identity;
        EntityReference reference = new EntityReference( identity );
        entityState = new BuilderEntityState( model.model(), reference );
        model.model().initState( model.module(), entityState );
        entityState.setProperty( identityStateName, identity );
        prototypeInstance = model.model().newInstance( uow, model.module(), entityState );
    }
View Full Code Here

Examples of org.qi4j.api.entity.EntityReference

            if( jsonValue == null )
            {
                return null;
            }

            EntityReference value = jsonValue == JSONObject.NULL ? null : EntityReference.parseEntityReference(
                (String) jsonValue );
            return value;
        }
        catch( JSONException e )
        {
View Full Code Here

Examples of org.qi4j.api.entity.EntityReference

            JSONWriter associations = properties.endObject().key( "associations" ).object();
            for( Map.Entry<QualifiedName, EntityReference> stateNameEntityReferenceEntry : state.associations()
                .entrySet() )
            {
                EntityReference value = stateNameEntityReferenceEntry.getValue();
                associations.key( stateNameEntityReferenceEntry.getKey().name() ).
                    value( value != null ? value.identity() : null );
            }

            JSONWriter manyAssociations = associations.endObject().key( "manyassociations" ).object();
            for( Map.Entry<QualifiedName, List<EntityReference>> stateNameListEntry : state.manyAssociations()
                .entrySet() )
View Full Code Here

Examples of org.qi4j.api.entity.EntityReference

            for( AssociationDescriptor associationType : entityDescriptor.state().associations() )
            {
                try
                {
                    Object jsonValue = assocs.get( associationType.qualifiedName().name() );
                    EntityReference value = jsonValue == JSONObject.NULL ? null : EntityReference.parseEntityReference(
                        (String) jsonValue );
                    associations.put( associationType.qualifiedName(), value );
                }
                catch( JSONException e )
                {
                    // Association not found, default it to null
                    associations.put( associationType.qualifiedName(), null );
                    status = EntityStatus.UPDATED;
                }
            }

            JSONObject manyAssocs = jsonObject.getJSONObject( "manyassociations" );
            Map<QualifiedName, List<EntityReference>> manyAssociations = new HashMap<QualifiedName, List<EntityReference>>();
            for( AssociationDescriptor manyAssociationType : entityDescriptor.state().manyAssociations() )
            {
                List<EntityReference> references = new ArrayList<EntityReference>();
                try
                {
                    JSONArray jsonValues = manyAssocs.getJSONArray( manyAssociationType.qualifiedName().name() );
                    for( int i = 0; i < jsonValues.length(); i++ )
                    {
                        Object jsonValue = jsonValues.getString( i );
                        EntityReference value = jsonValue == JSONObject.NULL ? null : EntityReference.parseEntityReference(
                            (String) jsonValue );
                        references.add( value );
                    }
                    manyAssociations.put( manyAssociationType.qualifiedName(), references );
                }
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.