Package org.hibernate.persister.entity

Examples of org.hibernate.persister.entity.Loadable


  private String getConcreteEntityTypeName(
      ResultSet resultSet,
      ResultSetProcessingContext context,
      EntityKey entityKey) {
    final Loadable loadable = (Loadable) entityReference.getEntityPersister();
    if ( ! loadable.hasSubclasses() ) {
      return entityReference.getEntityPersister().getEntityName();
    }

    final Object discriminatorValue;
    try {
      discriminatorValue = loadable.getDiscriminatorType().nullSafeGet(
          resultSet,
          entityReferenceAliases.getColumnAliases().getSuffixedDiscriminatorAlias(),
          context.getSession(),
          null
      );
    }
    catch (SQLException e) {
      throw context.getSession().getFactory().getJdbcServices().getSqlExceptionHelper().convert(
          e,
          "Could not read discriminator value from ResultSet"
      );
    }

    final String result = loadable.getSubclassForDiscriminatorValue( discriminatorValue );

    if ( result == null ) {
      // whoops! we got an instance of another class hierarchy branch
      throw new WrongClassException(
          "Discriminator: " + discriminatorValue,
View Full Code Here


  throws SQLException, HibernateException {

    final Serializable id = key.getIdentifier();

    // Get the persister for the _subclass_
    final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName );

    if ( log.isTraceEnabled() ) {
      log.trace(
          "Initializing object from ResultSet: " +
          MessageHelper.infoString( persister, id, getFactory() )
        );
    }
   
    boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);

    // add temp entry so that the next step is circular-reference
    // safe - only needed because some types don't take proper
    // advantage of two-phase-load (esp. components)
    TwoPhaseLoad.addUninitializedEntity(
        key,
        object,
        persister,
        lockMode,
        !eagerPropertyFetch,
        session
      );

    //This is not very nice (and quite slow):
    final String[][] cols = persister == rootPersister ?
        getEntityAliases()[i].getSuffixedPropertyAliases() :
        getEntityAliases()[i].getSuffixedPropertyAliases(persister);

    final Object[] values = persister.hydrate(
        rs,
        id,
        object,
        rootPersister,
        cols,
        eagerPropertyFetch,
        session
      );

    final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null;

    final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
    if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
      String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
      if (ukName!=null) {
        final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName);
        final Type type = persister.getPropertyTypes()[index];
 
        // polymorphism not really handled completely correctly,
        // perhaps...well, actually its ok, assuming that the
        // entity name used in the lookup is the same as the
        // the one used here, which it will be
View Full Code Here

  throws SQLException, HibernateException {

    final Serializable id = key.getIdentifier();

    // Get the persister for the _subclass_
    final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName );

    if ( log.isTraceEnabled() ) {
      log.trace(
          "Initializing object from ResultSet: " +
          MessageHelper.infoString( persister, id, getFactory() )
        );
    }
   
    boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);

    // add temp entry so that the next step is circular-reference
    // safe - only needed because some types don't take proper
    // advantage of two-phase-load (esp. components)
    TwoPhaseLoad.addUninitializedEntity(
        key,
        object,
        persister,
        lockMode,
        !eagerPropertyFetch,
        session
      );

    //This is not very nice (and quite slow):
    final String[][] cols = persister == rootPersister ?
        getEntityAliases()[i].getSuffixedPropertyAliases() :
        getEntityAliases()[i].getSuffixedPropertyAliases(persister);

    final Object[] values = persister.hydrate(
        rs,
        id,
        object,
        rootPersister,
        cols,
        eagerPropertyFetch,
        session
      );

    final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null;

    final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
    if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
      String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
      if (ukName!=null) {
        final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName);
        final Type type = persister.getPropertyTypes()[index];
 
        // polymorphism not really handled completely correctly,
        // perhaps...well, actually its ok, assuming that the
        // entity name used in the lookup is the same as the
        // the one used here, which it will be
View Full Code Here

  public Type getIdentifierType(Criteria subcriteria) {
    return ( ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) ) ).getIdentifierType();
  }

  public TypedValue getTypedIdentifierValue(Criteria subcriteria, Object value) {
    final Loadable loadable = ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) );
    return new TypedValue(
        loadable.getIdentifierType(),
            value,
            EntityMode.POJO
    );
  }
View Full Code Here

  throws SQLException, HibernateException {

    final Serializable id = key.getIdentifier();

    // Get the persister for the _subclass_
    final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName );

    if ( log.isTraceEnabled() ) {
      log.trace(
          "Initializing object from ResultSet: " +
          MessageHelper.infoString( persister, id, getFactory() )
        );
    }
   
    boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);

    // add temp entry so that the next step is circular-reference
    // safe - only needed because some types don't take proper
    // advantage of two-phase-load (esp. components)
    TwoPhaseLoad.addUninitializedEntity(
        key,
        object,
        persister,
        lockMode,
        !eagerPropertyFetch,
        session
      );

    //This is not very nice (and quite slow):
    final String[][] cols = persister == rootPersister ?
        getEntityAliases()[i].getSuffixedPropertyAliases() :
        getEntityAliases()[i].getSuffixedPropertyAliases(persister);

    final Object[] values = persister.hydrate(
        rs,
        id,
        object,
        rootPersister,
        cols,
        eagerPropertyFetch,
        session
      );

    final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null;

    final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
    if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
      String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
      if (ukName!=null) {
        final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName);
        final Type type = persister.getPropertyTypes()[index];
 
        // polymorphism not really handled completely correctly,
        // perhaps...well, actually its ok, assuming that the
        // entity name used in the lookup is the same as the
        // the one used here, which it will be
View Full Code Here

  public Type getIdentifierType(Criteria subcriteria) {
    return ( ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) ) ).getIdentifierType();
  }

  public TypedValue getTypedIdentifierValue(Criteria subcriteria, Object value) {
    final Loadable loadable = ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) );
    return new TypedValue(
        loadable.getIdentifierType(),
            value,
            EntityMode.POJO
    );
  }
View Full Code Here

  throws SQLException, HibernateException {

    final Serializable id = key.getIdentifier();

    // Get the persister for the _subclass_
    final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName );

    if ( LOG.isTraceEnabled() )
      LOG.tracev( "Initializing object from ResultSet: {0}", MessageHelper.infoString( persister, id, getFactory() ) );

    boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);

    // add temp entry so that the next step is circular-reference
    // safe - only needed because some types don't take proper
    // advantage of two-phase-load (esp. components)
    TwoPhaseLoad.addUninitializedEntity(
        key,
        object,
        persister,
        lockMode,
        !eagerPropertyFetch,
        session
      );

    //This is not very nice (and quite slow):
    final String[][] cols = persister == rootPersister ?
        getEntityAliases()[i].getSuffixedPropertyAliases() :
        getEntityAliases()[i].getSuffixedPropertyAliases(persister);

    final Object[] values = persister.hydrate(
        rs,
        id,
        object,
        rootPersister,
        cols,
        eagerPropertyFetch,
        session
      );

    final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null;

    final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
    if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
      String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
      if (ukName!=null) {
        final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName);
        final Type type = persister.getPropertyTypes()[index];

        // polymorphism not really handled completely correctly,
        // perhaps...well, actually its ok, assuming that the
        // entity name used in the lookup is the same as the
        // the one used here, which it will be

        EntityUniqueKey euk = new EntityUniqueKey(
            rootPersister.getEntityName(), //polymorphism comment above
            ukName,
            type.semiResolve( values[index], session, object ),
            type,
            persister.getEntityMode(),
            session.getFactory()
        );
        session.getPersistenceContext().addEntity( euk, object );
      }
    }
View Full Code Here

  public Type getIdentifierType(Criteria subcriteria) {
    return ( ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) ) ).getIdentifierType();
  }

  public TypedValue getTypedIdentifierValue(Criteria subcriteria, Object value) {
    final Loadable loadable = ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) );
    return new TypedValue(
        loadable.getIdentifierType(),
            value,
            EntityMode.POJO
    );
  }
View Full Code Here

  throws SQLException, HibernateException {

    final Serializable id = key.getIdentifier();

    // Get the persister for the _subclass_
    final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName );

    if ( LOG.isTraceEnabled() )
      LOG.tracev( "Initializing object from ResultSet: {0}", MessageHelper.infoString( persister, id, getFactory() ) );

    boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);

    // add temp entry so that the next step is circular-reference
    // safe - only needed because some types don't take proper
    // advantage of two-phase-load (esp. components)
    TwoPhaseLoad.addUninitializedEntity(
        key,
        object,
        persister,
        lockMode,
        !eagerPropertyFetch,
        session
      );

    //This is not very nice (and quite slow):
    final String[][] cols = persister == rootPersister ?
        getEntityAliases()[i].getSuffixedPropertyAliases() :
        getEntityAliases()[i].getSuffixedPropertyAliases(persister);

    final Object[] values = persister.hydrate(
        rs,
        id,
        object,
        rootPersister,
        cols,
        eagerPropertyFetch,
        session
      );

    final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null;

    final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
    if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
      String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
      if (ukName!=null) {
        final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName);
        final Type type = persister.getPropertyTypes()[index];

        // polymorphism not really handled completely correctly,
        // perhaps...well, actually its ok, assuming that the
        // entity name used in the lookup is the same as the
        // the one used here, which it will be

        EntityUniqueKey euk = new EntityUniqueKey(
            rootPersister.getEntityName(), //polymorphism comment above
            ukName,
            type.semiResolve( values[index], session, object ),
            type,
            persister.getEntityMode(),
            session.getFactory()
        );
        session.getPersistenceContext().addEntity( euk, object );
      }
    }
View Full Code Here

  throws SQLException, HibernateException {

    final Serializable id = key.getIdentifier();

    // Get the persister for the _subclass_
    final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName );

    if ( log.isTraceEnabled() ) {
      log.trace(
          "Initializing object from ResultSet: " +
          MessageHelper.infoString( persister, id, getFactory() )
        );
    }
   
    boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);

    // add temp entry so that the next step is circular-reference
    // safe - only needed because some types don't take proper
    // advantage of two-phase-load (esp. components)
    TwoPhaseLoad.addUninitializedEntity(
        key,
        object,
        persister,
        lockMode,
        !eagerPropertyFetch,
        session
      );

    //This is not very nice (and quite slow):
    final String[][] cols = persister == rootPersister ?
        getEntityAliases()[i].getSuffixedPropertyAliases() :
        getEntityAliases()[i].getSuffixedPropertyAliases(persister);

    final Object[] values = persister.hydrate(
        rs,
        id,
        object,
        rootPersister,
        cols,
        eagerPropertyFetch,
        session
      );

    final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null;

    final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
    if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
      String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
      if (ukName!=null) {
        final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName);
        final Type type = persister.getPropertyTypes()[index];
 
        // polymorphism not really handled completely correctly,
        // perhaps...well, actually its ok, assuming that the
        // entity name used in the lookup is the same as the
        // the one used here, which it will be
View Full Code Here

TOP

Related Classes of org.hibernate.persister.entity.Loadable

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.