Package org.hibernate

Examples of org.hibernate.EntityMode


    final Object result = target == null ?
        instantiate( owner, session ) :
        target;

    final EntityMode entityMode = session.getEntityMode();
    Object[] values = TypeFactory.replace(
        getPropertyValues( original, entityMode ),
        getPropertyValues( result, entityMode ),
        propertyTypes,
        session,
View Full Code Here


   * @param key The key of the collection being requested.
   *
   * @return The loading collection (see discussion above).
   */
  public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key) {
    final EntityMode em = persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode();
    final CollectionKey collectionKey = new CollectionKey( persister, key, em );
    if ( LOG.isTraceEnabled() ) {
      LOG.tracev( "Starting attempt to find loading collection [{0}]",
          MessageHelper.collectionInfoString( persister.getRole(), key ) );
    }
View Full Code Here

  @Override
  public String getExplicitTuplizerClassName() {
    if ( componentElement.getTuplizer() == null ) {
      return null;
    }
    final EntityMode entityMode = StringHelper.isEmpty( componentElement.getClazz() ) ? EntityMode.MAP : EntityMode.POJO;
    for ( JaxbTuplizerElement tuplizerElement : componentElement.getTuplizer() ) {
      if ( entityMode == EntityMode.parse( tuplizerElement.getEntityMode() ) ) {
        return tuplizerElement.getClazz();
      }
    }
View Full Code Here

  @Override
  public String getCustomTuplizerClassName() {
    if ( entityElement.getTuplizer() == null ) {
      return null;
    }
    final EntityMode entityMode = determineEntityMode();
    for ( JaxbTuplizerElement tuplizerElement : entityElement.getTuplizer() ) {
      if ( entityMode == EntityMode.parse( tuplizerElement.getEntityMode() ) ) {
        return tuplizerElement.getClazz();
      }
    }
View Full Code Here

   */
  public Object getCollection(Serializable key, SessionImplementor session, Object owner) {

    CollectionPersister persister = getPersister( session );
    final PersistenceContext persistenceContext = session.getPersistenceContext();
    final EntityMode entityMode = persister.getOwnerEntityPersister().getEntityMode();

    // check if collection is currently being loaded
    PersistentCollection collection = persistenceContext.getLoadContexts().locateLoadingCollection( persister, key );
   
    if ( collection == null ) {
View Full Code Here

    }

    iter = node.elementIterator( "tuplizer" );
    while ( iter.hasNext() ) {
      final Element tuplizerElem = ( Element ) iter.next();
      EntityMode mode = EntityMode.parse( tuplizerElem.attributeValue( "entity-mode" ) );
      component.addTuplizer( mode, tuplizerElem.attributeValue( "class" ) );
    }
  }
View Full Code Here

  private EntityMode getEntityMode(Criteria criteria, CriteriaQuery criteriaQuery) {
    final EntityPersister meta = criteriaQuery.getFactory().getEntityPersister(
        criteriaQuery.getEntityName( criteria )
    );
    final EntityMode result = meta.getEntityMode();
    if ( ! meta.getEntityMetamodel().getTuplizer().isInstance( exampleEntity ) ) {
      throw new ClassCastException( exampleEntity.getClass().getName() );
    }
    return result;
  }
View Full Code Here

      settings.setAutoCreateSchema(true);
      settings.setAutoDropSchema(true);
    }
    settings.setImportFiles( properties.getProperty( Environment.HBM2DDL_IMPORT_FILES ) );

    EntityMode defaultEntityMode = EntityMode.parse( properties.getProperty( Environment.DEFAULT_ENTITY_MODE ) );
    log.info( "Default entity-mode: " + defaultEntityMode );
    settings.setDefaultEntityMode( defaultEntityMode );

    boolean namedQueryChecking = PropertiesHelper.getBoolean( Environment.QUERY_STARTUP_CHECKING, properties, true );
    log.info( "Named query checking : " + enabledDisabled( namedQueryChecking ) );
View Full Code Here

   
    EntityPersister persister = factory.getEntityPersister( associatedEntityName );
    StringBuilder result = new StringBuilder().append( associatedEntityName );

    if ( persister.hasIdentifierProperty() ) {
      final EntityMode entityMode = persister.getEntityMode();
      final Serializable id;
      if ( entityMode == null ) {
        if ( isEmbeddedInXML ) {
          throw new ClassCastException( value.getClass().getName() );
        }
View Full Code Here

    if ( property == null ) {
      return;
    }
    if ( property.isAnnotationPresent( Tuplizers.class ) ) {
      for ( Tuplizer tuplizer : property.getAnnotation( Tuplizers.class ).value() ) {
        EntityMode mode = EntityMode.parse( tuplizer.entityMode() );
        //todo tuplizer.entityModeType
        component.addTuplizer( mode, tuplizer.impl().getName() );
      }
    }
    if ( property.isAnnotationPresent( Tuplizer.class ) ) {
      Tuplizer tuplizer = property.getAnnotation( Tuplizer.class );
      EntityMode mode = EntityMode.parse( tuplizer.entityMode() );
      //todo tuplizer.entityModeType
      component.addTuplizer( mode, tuplizer.impl().getName() );
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.EntityMode

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.