diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityEntry.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityEntry.java index bd7be01a68..f9f07d57a6 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityEntry.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/EntityEntry.java @@ -109,7 +109,7 @@ public final class EntityEntry implements Serializable { final Status status, final Status previousStatus, final Object[] loadedState, - final Object[] deletedState, + final Object[] deletedState, final Object version, final LockMode lockMode, final boolean existsInDatabase, @@ -206,11 +206,11 @@ public final class EntityEntry implements Serializable { public boolean isBeingReplicated() { return isBeingReplicated; } - + public Object getRowId() { return rowId; } - + /** * Handle updating the internal state of the entry after actually performing * the database update. Specifically we update the snapshot information and @@ -236,8 +236,8 @@ public final class EntityEntry implements Serializable { interceptor.clearDirty(); } } - if( entity instanceof SelfDirtinessTracker) - ((SelfDirtinessTracker) entity).$$_hibernate_clearDirtyAttributes(); + if( entity instanceof SelfDirtinessTracker) + ((SelfDirtinessTracker) entity).$$_hibernate_clearDirtyAttributes(); persistenceContext.getSession() .getFactory() @@ -254,7 +254,7 @@ public final class EntityEntry implements Serializable { status = Status.GONE; existsInDatabase = false; } - + /** * After actually inserting a row, record the fact that the instance exists on the * database (needed for identity-column key generation) @@ -262,7 +262,7 @@ public final class EntityEntry implements Serializable { public void postInsert(Object[] insertedState) { existsInDatabase = true; } - + public boolean isNullifiable(boolean earlyInsert, SessionImplementor session) { return getStatus() == Status.SAVING || ( earlyInsert ? @@ -271,7 +271,7 @@ public final class EntityEntry implements Serializable { .contains( getEntityKey() ) ); } - + public Object getLoadedValue(String propertyName) { if ( loadedState == null ) { return null; @@ -303,24 +303,24 @@ public final class EntityEntry implements Serializable { @SuppressWarnings( {"SimplifiableIfStatement"}) private boolean isUnequivocallyNonDirty(Object entity) { - if(entity instanceof SelfDirtinessTracker) - return ((SelfDirtinessTracker) entity).$$_hibernate_hasDirtyAttributes(); + if(entity instanceof SelfDirtinessTracker) + return ((SelfDirtinessTracker) entity).$$_hibernate_hasDirtyAttributes(); final CustomEntityDirtinessStrategy customEntityDirtinessStrategy = persistenceContext.getSession().getFactory().getCustomEntityDirtinessStrategy(); if ( customEntityDirtinessStrategy.canDirtyCheck( entity, getPersister(), (Session) persistenceContext.getSession() ) ) { return ! customEntityDirtinessStrategy.isDirty( entity, getPersister(), (Session) persistenceContext.getSession() ); } - + if ( getPersister().hasMutableProperties() ) { return false; } - + if ( getPersister().getInstrumentationMetadata().isInstrumented() ) { // the entity must be instrumented (otherwise we cant check dirty flag) and the dirty flag is false return ! getPersister().getInstrumentationMetadata().extractInterceptor( entity ).isDirty(); } - + return false; } @@ -380,7 +380,7 @@ public final class EntityEntry implements Serializable { ); } } - + public String toString() { return "EntityEntry" + MessageHelper.infoString(entityName, id) + @@ -431,27 +431,27 @@ public final class EntityEntry implements Serializable { */ public static EntityEntry deserialize( ObjectInputStream ois, - PersistenceContext persistenceContext) throws IOException, ClassNotFoundException { + PersistenceContext persistenceContext) throws IOException, ClassNotFoundException { String previousStatusString; return new EntityEntry( // this complexity comes from non-flushed changes, should really look at how that reattaches entries ( persistenceContext.getSession() == null ? null : persistenceContext.getSession().getFactory() ), - (String) ois.readObject(), + (String) ois.readObject(), ( Serializable ) ois.readObject(), - EntityMode.parse( (String) ois.readObject() ), + EntityMode.parse( (String) ois.readObject() ), (String) ois.readObject(), Status.valueOf( (String) ois.readObject() ), ( ( previousStatusString = ( String ) ois.readObject() ).length() == 0 ? null : Status.valueOf( previousStatusString ) ), - ( Object[] ) ois.readObject(), - ( Object[] ) ois.readObject(), - ois.readObject(), - LockMode.valueOf( (String) ois.readObject() ), - ois.readBoolean(), - ois.readBoolean(), - ois.readBoolean(), + ( Object[] ) ois.readObject(), + ( Object[] ) ois.readObject(), + ois.readObject(), + LockMode.valueOf( (String) ois.readObject() ), + ois.readBoolean(), + ois.readBoolean(), + ois.readBoolean(), persistenceContext ); } diff --git a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java index 39c8a925f6..bca10fd4e6 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java @@ -113,8 +113,8 @@ import org.hibernate.type.VersionType; */ public abstract class Loader { - protected static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Loader.class.getName()); - protected static final boolean DEBUG_ENABLED = LOG.isDebugEnabled(); + protected static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Loader.class.getName()); + protected static final boolean DEBUG_ENABLED = LOG.isDebugEnabled(); private final SessionFactoryImplementor factory; private ColumnNameCache columnNameCache; @@ -377,10 +377,10 @@ public abstract class Loader { * @throws HibernateException */ public Object loadSingleRow( - final ResultSet resultSet, - final SessionImplementor session, - final QueryParameters queryParameters, - final boolean returnProxies) throws HibernateException { + final ResultSet resultSet, + final SessionImplementor session, + final QueryParameters queryParameters, + final boolean returnProxies) throws HibernateException { final int entitySpan = getEntityPersisters().length; final List hydratedObjects = entitySpan == 0 ? @@ -389,7 +389,7 @@ public abstract class Loader { final Object result; try { result = getRowFromResultSet( - resultSet, + resultSet, session, queryParameters, getLockModes( queryParameters.getLockOptions() ), @@ -401,9 +401,9 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not read next row of results", - getSQLString() + sqle, + "could not read next row of results", + getSQLString() ); } @@ -418,11 +418,11 @@ public abstract class Loader { } private Object sequentialLoad( - final ResultSet resultSet, - final SessionImplementor session, - final QueryParameters queryParameters, - final boolean returnProxies, - final EntityKey keyToRead) throws HibernateException { + final ResultSet resultSet, + final SessionImplementor session, + final QueryParameters queryParameters, + final boolean returnProxies, + final EntityKey keyToRead) throws HibernateException { final int entitySpan = getEntityPersisters().length; final List hydratedObjects = entitySpan == 0 ? @@ -460,9 +460,9 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not doAfterTransactionCompletion sequential read of results (forward)", - getSQLString() + sqle, + "could not doAfterTransactionCompletion sequential read of results (forward)", + getSQLString() ); } @@ -501,10 +501,10 @@ public abstract class Loader { * @throws HibernateException */ public Object loadSequentialRowsForward( - final ResultSet resultSet, - final SessionImplementor session, - final QueryParameters queryParameters, - final boolean returnProxies) throws HibernateException { + final ResultSet resultSet, + final SessionImplementor session, + final QueryParameters queryParameters, + final boolean returnProxies) throws HibernateException { // note that for sequential scrolling, we make the assumption that // the first persister element is the "root entity" @@ -537,9 +537,9 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not perform sequential read of results (forward)", - getSQLString() + sqle, + "could not perform sequential read of results (forward)", + getSQLString() ); } } @@ -558,11 +558,11 @@ public abstract class Loader { * @throws HibernateException */ public Object loadSequentialRowsReverse( - final ResultSet resultSet, - final SessionImplementor session, - final QueryParameters queryParameters, - final boolean returnProxies, - final boolean isLogicallyAfterLast) throws HibernateException { + final ResultSet resultSet, + final SessionImplementor session, + final QueryParameters queryParameters, + final boolean returnProxies, + final boolean isLogicallyAfterLast) throws HibernateException { // note that for sequential scrolling, we make the assumption that // the first persister element is the "root entity" @@ -662,9 +662,9 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not doAfterTransactionCompletion sequential read of results (forward)", - getSQLString() + sqle, + "could not doAfterTransactionCompletion sequential read of results (forward)", + getSQLString() ); } } @@ -684,14 +684,14 @@ public abstract class Loader { } private Object getRowFromResultSet( - final ResultSet resultSet, - final SessionImplementor session, - final QueryParameters queryParameters, - final LockMode[] lockModesArray, - final EntityKey optionalObjectKey, - final List hydratedObjects, - final EntityKey[] keys, - boolean returnProxies) throws SQLException, HibernateException { + final ResultSet resultSet, + final SessionImplementor session, + final QueryParameters queryParameters, + final LockMode[] lockModesArray, + final EntityKey optionalObjectKey, + final List hydratedObjects, + final EntityKey[] keys, + boolean returnProxies) throws SQLException, HibernateException { return getRowFromResultSet( resultSet, session, @@ -706,15 +706,15 @@ public abstract class Loader { } private Object getRowFromResultSet( - final ResultSet resultSet, - final SessionImplementor session, - final QueryParameters queryParameters, - final LockMode[] lockModesArray, - final EntityKey optionalObjectKey, - final List hydratedObjects, - final EntityKey[] keys, - boolean returnProxies, - ResultTransformer forcedResultTransformer) throws SQLException, HibernateException { + final ResultSet resultSet, + final SessionImplementor session, + final QueryParameters queryParameters, + final LockMode[] lockModesArray, + final EntityKey optionalObjectKey, + final List hydratedObjects, + final EntityKey[] keys, + boolean returnProxies, + ResultTransformer forcedResultTransformer) throws SQLException, HibernateException { final Loadable[] persisters = getEntityPersisters(); final int entitySpan = persisters.length; extractKeysFromResultSet( persisters, queryParameters, resultSet, session, keys, lockModesArray, hydratedObjects ); @@ -723,7 +723,7 @@ public abstract class Loader { // this call is side-effecty Object[] row = getRow( - resultSet, + resultSet, persisters, keys, queryParameters.getOptionalObject(), @@ -947,8 +947,8 @@ public abstract class Loader { int count; for ( count = 0; count < maxRows && rs.next(); count++ ) { - if ( DEBUG_ENABLED ) - LOG.debugf( "Result set row: %s", count ); + if ( DEBUG_ENABLED ) + LOG.debugf( "Result set row: %s", count ); Object result = getRowFromResultSet( rs, session, @@ -967,8 +967,7 @@ public abstract class Loader { } } - if ( LOG.isTraceEnabled() ) - LOG.tracev( "Done processing result set ({0} rows)", count ); + LOG.tracev( "Done processing result set ({0} rows)", count ); initializeEntitiesAndCollections( hydratedObjects, @@ -1110,8 +1109,7 @@ public abstract class Loader { if ( hydratedObjects!=null ) { int hydratedObjectsSize = hydratedObjects.size(); - if ( LOG.isTraceEnabled() ) - LOG.tracev( "Total objects hydrated: {0}", hydratedObjectsSize ); + LOG.tracev( "Total objects hydrated: {0}", hydratedObjectsSize ); for ( int i = 0; i < hydratedObjectsSize; i++ ) { TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre ); } @@ -1222,9 +1220,9 @@ public abstract class Loader { * session. */ private void registerNonExists( - final EntityKey[] keys, - final Loadable[] persisters, - final SessionImplementor session) { + final EntityKey[] keys, + final Loadable[] persisters, + final SessionImplementor session) { final int[] owners = getOwners(); if ( owners != null ) { @@ -1284,12 +1282,12 @@ public abstract class Loader { * Read one collection element from the current row of the JDBC result set */ private void readCollectionElement( - final Object optionalOwner, - final Serializable optionalKey, - final CollectionPersister persister, - final CollectionAliases descriptor, - final ResultSet rs, - final SessionImplementor session) + final Object optionalOwner, + final Serializable optionalKey, + final CollectionPersister persister, + final CollectionAliases descriptor, + final ResultSet rs, + final SessionImplementor session) throws HibernateException, SQLException { final PersistenceContext persistenceContext = session.getPersistenceContext(); @@ -1355,9 +1353,9 @@ public abstract class Loader { * no elements (hence no rows in the result set). */ private void handleEmptyCollections( - final Serializable[] keys, - final Object resultSetId, - final SessionImplementor session) { + final Serializable[] keys, + final Object resultSetId, + final SessionImplementor session) { if ( keys != null ) { final boolean debugEnabled = LOG.isDebugEnabled(); @@ -1393,11 +1391,11 @@ public abstract class Loader { * If an id is given, don't bother going to the ResultSet. */ private EntityKey getKeyFromResultSet( - final int i, - final Loadable persister, - final Serializable id, - final ResultSet rs, - final SessionImplementor session) throws HibernateException, SQLException { + final int i, + final Loadable persister, + final Serializable id, + final ResultSet rs, + final SessionImplementor session) throws HibernateException, SQLException { Serializable resultId; @@ -1434,12 +1432,12 @@ public abstract class Loader { * if the version numbers are different */ private void checkVersion( - final int i, - final Loadable persister, - final Serializable id, - final Object entity, - final ResultSet rs, - final SessionImplementor session) + final int i, + final Loadable persister, + final Serializable id, + final Object entity, + final ResultSet rs, + final SessionImplementor session) throws HibernateException, SQLException { Object version = session.getPersistenceContext().getEntry( entity ).getVersion(); @@ -1471,14 +1469,14 @@ public abstract class Loader { * object should be initialized. */ private Object[] getRow( - final ResultSet rs, - final Loadable[] persisters, - final EntityKey[] keys, - final Object optionalObject, - final EntityKey optionalObjectKey, - final LockMode[] lockModes, - final List hydratedObjects, - final SessionImplementor session) + final ResultSet rs, + final Loadable[] persisters, + final EntityKey[] keys, + final Object optionalObject, + final EntityKey optionalObjectKey, + final LockMode[] lockModes, + final List hydratedObjects, + final SessionImplementor session) throws HibernateException, SQLException { final int cols = persisters.length; @@ -1541,12 +1539,12 @@ public abstract class Loader { */ private void instanceAlreadyLoaded( final ResultSet rs, - final int i, - final Loadable persister, - final EntityKey key, - final Object object, - final LockMode requestedLockMode, - final SessionImplementor session) + final int i, + final Loadable persister, + final EntityKey key, + final Object object, + final LockMode requestedLockMode, + final SessionImplementor session) throws HibernateException, SQLException { if ( !persister.isInstance( object ) ) { throw new WrongClassException( @@ -1574,16 +1572,16 @@ public abstract class Loader { * The entity instance is not in the session cache */ private Object instanceNotYetLoaded( - final ResultSet rs, - final int i, - final Loadable persister, - final String rowIdAlias, - final EntityKey key, - final LockMode lockMode, - final EntityKey optionalObjectKey, - final Object optionalObject, - final List hydratedObjects, - final SessionImplementor session) + final ResultSet rs, + final int i, + final Loadable persister, + final String rowIdAlias, + final EntityKey key, + final LockMode lockMode, + final EntityKey optionalObjectKey, + final Object optionalObject, + final List hydratedObjects, + final SessionImplementor session) throws HibernateException, SQLException { final String instanceClass = getInstanceClass( rs, @@ -1656,15 +1654,15 @@ public abstract class Loader { * and pass the hydrates state to the session. */ private void loadFromResultSet( - final ResultSet rs, - final int i, - final Object object, - final String instanceEntityName, - final EntityKey key, - final String rowIdAlias, - final LockMode lockMode, - final Loadable rootPersister, - final SessionImplementor session) + final ResultSet rs, + final int i, + final Object object, + final String instanceEntityName, + final EntityKey key, + final String rowIdAlias, + final LockMode lockMode, + final Loadable rootPersister, + final SessionImplementor session) throws SQLException, HibernateException { final Serializable id = key.getIdentifier(); @@ -1985,10 +1983,10 @@ public abstract class Loader { * @throws org.hibernate.HibernateException Indicates problems delegating binding to the types. */ protected int bindPositionalParameters( - final PreparedStatement statement, - final QueryParameters queryParameters, - final int startIndex, - final SessionImplementor session) throws SQLException, HibernateException { + final PreparedStatement statement, + final QueryParameters queryParameters, + final int startIndex, + final SessionImplementor session) throws SQLException, HibernateException { final Object[] values = queryParameters.getFilteredPositionalParameterValues(); final Type[] types = queryParameters.getFilteredPositionalParameterTypes(); int span = 0; @@ -2056,11 +2054,11 @@ public abstract class Loader { * Execute given PreparedStatement, advance to the first result and return SQL ResultSet. */ protected final ResultSet getResultSet( - final PreparedStatement st, - final RowSelection selection, - final LimitHandler limitHandler, - final boolean autodiscovertypes, - final SessionImplementor session) + final PreparedStatement st, + final RowSelection selection, + final LimitHandler limitHandler, + final boolean autodiscovertypes, + final SessionImplementor session) throws SQLException, HibernateException { try { @@ -2092,8 +2090,7 @@ public abstract class Loader { // potential deadlock issues due to nature of code. if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) { try { - if ( LOG.isDebugEnabled() ) - LOG.debugf( "Wrapping result set [%s]", rs ); + LOG.debugf( "Wrapping result set [%s]", rs ); return session.getFactory() .getJdbcServices() .getResultSetWrapper().wrap( rs, retreiveColumnNameToIndexCache( rs ) ); @@ -2285,9 +2282,9 @@ public abstract class Loader { * Called by wrappers that batch initialize collections */ public final void loadCollectionBatch( - final SessionImplementor session, - final Serializable[] ids, - final Type type) throws HibernateException { + final SessionImplementor session, + final Serializable[] ids, + final Type type) throws HibernateException { if ( LOG.isDebugEnabled() ) LOG.debugf( "Batch loading collection: %s", @@ -2304,10 +2301,10 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not initialize a collection batch: " + - MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ), - getSQLString() + sqle, + "could not initialize a collection batch: " + + MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ), + getSQLString() ); } @@ -2319,12 +2316,12 @@ public abstract class Loader { * Called by subclasses that batch initialize collections */ protected final void loadCollectionSubselect( - final SessionImplementor session, - final Serializable[] ids, - final Object[] parameterValues, - final Type[] parameterTypes, - final Map namedParameters, - final Type type) throws HibernateException { + final SessionImplementor session, + final Serializable[] ids, + final Object[] parameterValues, + final Type[] parameterTypes, + final Map namedParameters, + final Type type) throws HibernateException { Type[] idTypes = new Type[ids.length]; Arrays.fill( idTypes, type ); @@ -2336,10 +2333,10 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not load collection by subselect: " + - MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ), - getSQLString() + sqle, + "could not load collection by subselect: " + + MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ), + getSQLString() ); } } @@ -2349,10 +2346,10 @@ public abstract class Loader { * by subclasses that implement cacheable queries */ protected List list( - final SessionImplementor session, - final QueryParameters queryParameters, - final Set querySpaces, - final Type[] resultTypes) throws HibernateException { + final SessionImplementor session, + final QueryParameters queryParameters, + final Set querySpaces, + final Type[] resultTypes) throws HibernateException { final boolean cacheable = factory.getSettings().isQueryCacheEnabled() && queryParameters.isCacheable(); @@ -2554,9 +2551,9 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not execute query", - getSQLString() + sqle, + "could not execute query", + getSQLString() ); } @@ -2606,10 +2603,10 @@ public abstract class Loader { * the ScrollableResults. */ protected ScrollableResults scroll( - final QueryParameters queryParameters, - final Type[] returnTypes, - final HolderInstantiator holderInstantiator, - final SessionImplementor session) throws HibernateException { + final QueryParameters queryParameters, + final Type[] returnTypes, + final HolderInstantiator holderInstantiator, + final SessionImplementor session) throws HibernateException { checkScrollability(); @@ -2659,9 +2656,9 @@ public abstract class Loader { } catch ( SQLException sqle ) { throw factory.getSQLExceptionHelper().convert( - sqle, - "could not execute query using scroll", - getSQLString() + sqle, + "could not execute query using scroll", + getSQLString() ); } @@ -2693,7 +2690,7 @@ public abstract class Loader { } @Override - public String toString() { + public String toString() { return getClass().getName() + '(' + getSQLString() + ')'; } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index b48742b4c0..3390499146 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -82,7 +82,6 @@ import org.hibernate.engine.spi.PersistenceContext.NaturalIdHelper; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.ValueInclusion; -import org.hibernate.event.spi.EventSource; import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.PostInsertIdentifierGenerator; import org.hibernate.id.PostInsertIdentityPersister; @@ -151,10 +150,9 @@ import org.jboss.logging.Logger; */ public abstract class AbstractEntityPersister implements OuterJoinLoadable, Queryable, ClassMetadata, UniqueKeyLoadable, - SQLLoadable, LazyPropertyInitializer, PostInsertIdentityPersister, Lockable { + SQLLoadable, LazyPropertyInitializer, PostInsertIdentityPersister, Lockable { - private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, - AbstractEntityPersister.class.getName()); + private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, AbstractEntityPersister.class.getName() ); public static final String ENTITY_CLASS = "class"; @@ -2155,19 +2153,18 @@ public abstract class AbstractEntityPersister return subclassPropertyNameClosure; } - @Override - public int[] resolveAttributeIndexes(Set properties) { - Iterator iter = properties.iterator(); - int[] fields = new int[properties.size()]; - int counter = 0; - while(iter.hasNext()) { - Integer index = entityMetamodel.getPropertyIndexOrNull(iter.next()); - if(index != null) - fields[counter++] = index; - } - - return fields; - } + @Override + public int[] resolveAttributeIndexes(Set properties) { + Iterator iter = properties.iterator(); + int[] fields = new int[properties.size()]; + int counter = 0; + while(iter.hasNext()) { + Integer index = entityMetamodel.getPropertyIndexOrNull( iter.next() ); + if ( index != null ) + fields[counter++] = index; + } + return fields; + } protected String[] getSubclassPropertySubclassNameClosure() { return subclassPropertySubclassNameClosure; @@ -2650,7 +2647,7 @@ public abstract class AbstractEntityPersister } private boolean checkVersion(final boolean[] includeProperty) { - return includeProperty[ getVersionProperty() ] + return includeProperty[ getVersionProperty() ] || entityMetamodel.isVersionGenerated(); } @@ -2825,15 +2822,15 @@ public abstract class AbstractEntityPersister */ protected int dehydrate( final Serializable id, - final Object[] fields, - final Object rowId, - final boolean[] includeProperty, - final boolean[][] includeColumns, - final int j, - final PreparedStatement ps, - final SessionImplementor session, - int index, - boolean isUpdate ) throws SQLException, HibernateException { + final Object[] fields, + final Object rowId, + final boolean[] includeProperty, + final boolean[][] includeColumns, + final int j, + final PreparedStatement ps, + final SessionImplementor session, + int index, + boolean isUpdate ) throws SQLException, HibernateException { if ( LOG.isTraceEnabled() ) { LOG.tracev( "Dehydrating entity: {0}", MessageHelper.infoString( this, id, getFactory() ) ); @@ -2873,7 +2870,7 @@ public abstract class AbstractEntityPersister final Serializable id, final Object rowId, final PreparedStatement ps, - final SessionImplementor session, + final SessionImplementor session, int index ) throws SQLException { if ( rowId != null ) { ps.setObject( index, rowId ); @@ -2892,12 +2889,12 @@ public abstract class AbstractEntityPersister */ public Object[] hydrate( final ResultSet rs, - final Serializable id, - final Object object, - final Loadable rootLoadable, - final String[][] suffixedPropertyColumns, - final boolean allProperties, - final SessionImplementor session) throws SQLException, HibernateException { + final Serializable id, + final Object object, + final Loadable rootLoadable, + final String[][] suffixedPropertyColumns, + final boolean allProperties, + final SessionImplementor session) throws SQLException, HibernateException { if ( LOG.isTraceEnabled() ) { LOG.tracev( "Hydrating entity: {0}", MessageHelper.infoString( this, id, getFactory() ) ); @@ -3010,10 +3007,10 @@ public abstract class AbstractEntityPersister */ protected Serializable insert( final Object[] fields, - final boolean[] notNull, - String sql, - final Object object, - final SessionImplementor session) throws HibernateException { + final boolean[] notNull, + String sql, + final Object object, + final SessionImplementor session) throws HibernateException { if ( LOG.isTraceEnabled() ) { LOG.tracev( "Inserting entity: {0} (native id)", getEntityName() ); @@ -3061,12 +3058,12 @@ public abstract class AbstractEntityPersister */ protected void insert( final Serializable id, - final Object[] fields, - final boolean[] notNull, - final int j, - final String sql, - final Object object, - final SessionImplementor session) throws HibernateException { + final Object[] fields, + final boolean[] notNull, + final int j, + final String sql, + final Object object, + final SessionImplementor session) throws HibernateException { if ( isInverseTable( j ) ) { return; @@ -3157,15 +3154,15 @@ public abstract class AbstractEntityPersister */ protected void updateOrInsert( final Serializable id, - final Object[] fields, - final Object[] oldFields, - final Object rowId, - final boolean[] includeProperty, - final int j, - final Object oldVersion, - final Object object, - final String sql, - final SessionImplementor session) throws HibernateException { + final Object[] fields, + final Object[] oldFields, + final Object rowId, + final boolean[] includeProperty, + final int j, + final Object oldVersion, + final Object object, + final String sql, + final SessionImplementor session) throws HibernateException { if ( !isInverseTable( j ) ) { @@ -3200,15 +3197,15 @@ public abstract class AbstractEntityPersister protected boolean update( final Serializable id, - final Object[] fields, - final Object[] oldFields, - final Object rowId, - final boolean[] includeProperty, - final int j, - final Object oldVersion, - final Object object, - final String sql, - final SessionImplementor session) throws HibernateException { + final Object[] fields, + final Object[] oldFields, + final Object rowId, + final boolean[] includeProperty, + final int j, + final Object oldVersion, + final Object object, + final String sql, + final SessionImplementor session) throws HibernateException { final Expectation expectation = Expectations.appropriateExpectation( updateResultCheckStyles[j] ); final boolean useBatch = j == 0 && expectation.canBeBatched() && isBatchable(); //note: updates to joined tables can't be batched... @@ -3445,14 +3442,14 @@ public abstract class AbstractEntityPersister */ public void update( final Serializable id, - final Object[] fields, - final int[] dirtyFields, - final boolean hasDirtyCollection, - final Object[] oldFields, - final Object oldVersion, - final Object object, - final Object rowId, - final SessionImplementor session) throws HibernateException { + final Object[] fields, + final int[] dirtyFields, + final boolean hasDirtyCollection, + final Object[] oldFields, + final Object oldVersion, + final Object object, + final Object rowId, + final SessionImplementor session) throws HibernateException { // apply any pre-update in-memory value generation if ( getEntityMetamodel().hasPreUpdateGeneratedValues() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java index 62cb2973d1..a45a1fb98f 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java @@ -773,7 +773,7 @@ public interface EntityPersister extends OptimisticCacheSource, EntityDefinition public FilterAliasGenerator getFilterAliasGenerator(final String rootAlias); - public int[] resolveAttributeIndexes(Set properties); + public int[] resolveAttributeIndexes(Set properties); public boolean canUseReferenceCacheEntries(); }