Whitespace and style fixes (only)

This commit is contained in:
Sanne Grinovero 2013-11-13 22:52:38 +00:00 committed by Steve Ebersole
parent 7f82763843
commit b2479bf00d
4 changed files with 245 additions and 251 deletions

View File

@ -109,7 +109,7 @@ public final class EntityEntry implements Serializable {
final Status status, final Status status,
final Status previousStatus, final Status previousStatus,
final Object[] loadedState, final Object[] loadedState,
final Object[] deletedState, final Object[] deletedState,
final Object version, final Object version,
final LockMode lockMode, final LockMode lockMode,
final boolean existsInDatabase, final boolean existsInDatabase,
@ -206,11 +206,11 @@ public final class EntityEntry implements Serializable {
public boolean isBeingReplicated() { public boolean isBeingReplicated() {
return isBeingReplicated; return isBeingReplicated;
} }
public Object getRowId() { public Object getRowId() {
return rowId; return rowId;
} }
/** /**
* Handle updating the internal state of the entry after actually performing * Handle updating the internal state of the entry after actually performing
* the database update. Specifically we update the snapshot information and * the database update. Specifically we update the snapshot information and
@ -236,8 +236,8 @@ public final class EntityEntry implements Serializable {
interceptor.clearDirty(); interceptor.clearDirty();
} }
} }
if( entity instanceof SelfDirtinessTracker) if( entity instanceof SelfDirtinessTracker)
((SelfDirtinessTracker) entity).$$_hibernate_clearDirtyAttributes(); ((SelfDirtinessTracker) entity).$$_hibernate_clearDirtyAttributes();
persistenceContext.getSession() persistenceContext.getSession()
.getFactory() .getFactory()
@ -254,7 +254,7 @@ public final class EntityEntry implements Serializable {
status = Status.GONE; status = Status.GONE;
existsInDatabase = false; existsInDatabase = false;
} }
/** /**
* After actually inserting a row, record the fact that the instance exists on the * After actually inserting a row, record the fact that the instance exists on the
* database (needed for identity-column key generation) * database (needed for identity-column key generation)
@ -262,7 +262,7 @@ public final class EntityEntry implements Serializable {
public void postInsert(Object[] insertedState) { public void postInsert(Object[] insertedState) {
existsInDatabase = true; existsInDatabase = true;
} }
public boolean isNullifiable(boolean earlyInsert, SessionImplementor session) { public boolean isNullifiable(boolean earlyInsert, SessionImplementor session) {
return getStatus() == Status.SAVING || ( return getStatus() == Status.SAVING || (
earlyInsert ? earlyInsert ?
@ -271,7 +271,7 @@ public final class EntityEntry implements Serializable {
.contains( getEntityKey() ) .contains( getEntityKey() )
); );
} }
public Object getLoadedValue(String propertyName) { public Object getLoadedValue(String propertyName) {
if ( loadedState == null ) { if ( loadedState == null ) {
return null; return null;
@ -303,24 +303,24 @@ public final class EntityEntry implements Serializable {
@SuppressWarnings( {"SimplifiableIfStatement"}) @SuppressWarnings( {"SimplifiableIfStatement"})
private boolean isUnequivocallyNonDirty(Object entity) { private boolean isUnequivocallyNonDirty(Object entity) {
if(entity instanceof SelfDirtinessTracker) if(entity instanceof SelfDirtinessTracker)
return ((SelfDirtinessTracker) entity).$$_hibernate_hasDirtyAttributes(); return ((SelfDirtinessTracker) entity).$$_hibernate_hasDirtyAttributes();
final CustomEntityDirtinessStrategy customEntityDirtinessStrategy = final CustomEntityDirtinessStrategy customEntityDirtinessStrategy =
persistenceContext.getSession().getFactory().getCustomEntityDirtinessStrategy(); persistenceContext.getSession().getFactory().getCustomEntityDirtinessStrategy();
if ( customEntityDirtinessStrategy.canDirtyCheck( entity, getPersister(), (Session) persistenceContext.getSession() ) ) { if ( customEntityDirtinessStrategy.canDirtyCheck( entity, getPersister(), (Session) persistenceContext.getSession() ) ) {
return ! customEntityDirtinessStrategy.isDirty( entity, getPersister(), (Session) persistenceContext.getSession() ); return ! customEntityDirtinessStrategy.isDirty( entity, getPersister(), (Session) persistenceContext.getSession() );
} }
if ( getPersister().hasMutableProperties() ) { if ( getPersister().hasMutableProperties() ) {
return false; return false;
} }
if ( getPersister().getInstrumentationMetadata().isInstrumented() ) { if ( getPersister().getInstrumentationMetadata().isInstrumented() ) {
// the entity must be instrumented (otherwise we cant check dirty flag) and the dirty flag is false // the entity must be instrumented (otherwise we cant check dirty flag) and the dirty flag is false
return ! getPersister().getInstrumentationMetadata().extractInterceptor( entity ).isDirty(); return ! getPersister().getInstrumentationMetadata().extractInterceptor( entity ).isDirty();
} }
return false; return false;
} }
@ -380,7 +380,7 @@ public final class EntityEntry implements Serializable {
); );
} }
} }
public String toString() { public String toString() {
return "EntityEntry" + return "EntityEntry" +
MessageHelper.infoString(entityName, id) + MessageHelper.infoString(entityName, id) +
@ -431,27 +431,27 @@ public final class EntityEntry implements Serializable {
*/ */
public static EntityEntry deserialize( public static EntityEntry deserialize(
ObjectInputStream ois, ObjectInputStream ois,
PersistenceContext persistenceContext) throws IOException, ClassNotFoundException { PersistenceContext persistenceContext) throws IOException, ClassNotFoundException {
String previousStatusString; String previousStatusString;
return new EntityEntry( return new EntityEntry(
// this complexity comes from non-flushed changes, should really look at how that reattaches entries // this complexity comes from non-flushed changes, should really look at how that reattaches entries
( persistenceContext.getSession() == null ? null : persistenceContext.getSession().getFactory() ), ( persistenceContext.getSession() == null ? null : persistenceContext.getSession().getFactory() ),
(String) ois.readObject(), (String) ois.readObject(),
( Serializable ) ois.readObject(), ( Serializable ) ois.readObject(),
EntityMode.parse( (String) ois.readObject() ), EntityMode.parse( (String) ois.readObject() ),
(String) ois.readObject(), (String) ois.readObject(),
Status.valueOf( (String) ois.readObject() ), Status.valueOf( (String) ois.readObject() ),
( ( previousStatusString = ( String ) ois.readObject() ).length() == 0 ? ( ( previousStatusString = ( String ) ois.readObject() ).length() == 0 ?
null : null :
Status.valueOf( previousStatusString ) Status.valueOf( previousStatusString )
), ),
( Object[] ) ois.readObject(), ( Object[] ) ois.readObject(),
( Object[] ) ois.readObject(), ( Object[] ) ois.readObject(),
ois.readObject(), ois.readObject(),
LockMode.valueOf( (String) ois.readObject() ), LockMode.valueOf( (String) ois.readObject() ),
ois.readBoolean(), ois.readBoolean(),
ois.readBoolean(), ois.readBoolean(),
ois.readBoolean(), ois.readBoolean(),
persistenceContext persistenceContext
); );
} }

View File

@ -113,8 +113,8 @@ import org.hibernate.type.VersionType;
*/ */
public abstract class Loader { public abstract class Loader {
protected static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Loader.class.getName()); protected static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Loader.class.getName());
protected static final boolean DEBUG_ENABLED = LOG.isDebugEnabled(); protected static final boolean DEBUG_ENABLED = LOG.isDebugEnabled();
private final SessionFactoryImplementor factory; private final SessionFactoryImplementor factory;
private ColumnNameCache columnNameCache; private ColumnNameCache columnNameCache;
@ -377,10 +377,10 @@ public abstract class Loader {
* @throws HibernateException * @throws HibernateException
*/ */
public Object loadSingleRow( public Object loadSingleRow(
final ResultSet resultSet, final ResultSet resultSet,
final SessionImplementor session, final SessionImplementor session,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final boolean returnProxies) throws HibernateException { final boolean returnProxies) throws HibernateException {
final int entitySpan = getEntityPersisters().length; final int entitySpan = getEntityPersisters().length;
final List hydratedObjects = entitySpan == 0 ? final List hydratedObjects = entitySpan == 0 ?
@ -389,7 +389,7 @@ public abstract class Loader {
final Object result; final Object result;
try { try {
result = getRowFromResultSet( result = getRowFromResultSet(
resultSet, resultSet,
session, session,
queryParameters, queryParameters,
getLockModes( queryParameters.getLockOptions() ), getLockModes( queryParameters.getLockOptions() ),
@ -401,9 +401,9 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not read next row of results", "could not read next row of results",
getSQLString() getSQLString()
); );
} }
@ -418,11 +418,11 @@ public abstract class Loader {
} }
private Object sequentialLoad( private Object sequentialLoad(
final ResultSet resultSet, final ResultSet resultSet,
final SessionImplementor session, final SessionImplementor session,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final boolean returnProxies, final boolean returnProxies,
final EntityKey keyToRead) throws HibernateException { final EntityKey keyToRead) throws HibernateException {
final int entitySpan = getEntityPersisters().length; final int entitySpan = getEntityPersisters().length;
final List hydratedObjects = entitySpan == 0 ? final List hydratedObjects = entitySpan == 0 ?
@ -460,9 +460,9 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not doAfterTransactionCompletion sequential read of results (forward)", "could not doAfterTransactionCompletion sequential read of results (forward)",
getSQLString() getSQLString()
); );
} }
@ -501,10 +501,10 @@ public abstract class Loader {
* @throws HibernateException * @throws HibernateException
*/ */
public Object loadSequentialRowsForward( public Object loadSequentialRowsForward(
final ResultSet resultSet, final ResultSet resultSet,
final SessionImplementor session, final SessionImplementor session,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final boolean returnProxies) throws HibernateException { final boolean returnProxies) throws HibernateException {
// note that for sequential scrolling, we make the assumption that // note that for sequential scrolling, we make the assumption that
// the first persister element is the "root entity" // the first persister element is the "root entity"
@ -537,9 +537,9 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not perform sequential read of results (forward)", "could not perform sequential read of results (forward)",
getSQLString() getSQLString()
); );
} }
} }
@ -558,11 +558,11 @@ public abstract class Loader {
* @throws HibernateException * @throws HibernateException
*/ */
public Object loadSequentialRowsReverse( public Object loadSequentialRowsReverse(
final ResultSet resultSet, final ResultSet resultSet,
final SessionImplementor session, final SessionImplementor session,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final boolean returnProxies, final boolean returnProxies,
final boolean isLogicallyAfterLast) throws HibernateException { final boolean isLogicallyAfterLast) throws HibernateException {
// note that for sequential scrolling, we make the assumption that // note that for sequential scrolling, we make the assumption that
// the first persister element is the "root entity" // the first persister element is the "root entity"
@ -662,9 +662,9 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not doAfterTransactionCompletion sequential read of results (forward)", "could not doAfterTransactionCompletion sequential read of results (forward)",
getSQLString() getSQLString()
); );
} }
} }
@ -684,14 +684,14 @@ public abstract class Loader {
} }
private Object getRowFromResultSet( private Object getRowFromResultSet(
final ResultSet resultSet, final ResultSet resultSet,
final SessionImplementor session, final SessionImplementor session,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final LockMode[] lockModesArray, final LockMode[] lockModesArray,
final EntityKey optionalObjectKey, final EntityKey optionalObjectKey,
final List hydratedObjects, final List hydratedObjects,
final EntityKey[] keys, final EntityKey[] keys,
boolean returnProxies) throws SQLException, HibernateException { boolean returnProxies) throws SQLException, HibernateException {
return getRowFromResultSet( return getRowFromResultSet(
resultSet, resultSet,
session, session,
@ -706,15 +706,15 @@ public abstract class Loader {
} }
private Object getRowFromResultSet( private Object getRowFromResultSet(
final ResultSet resultSet, final ResultSet resultSet,
final SessionImplementor session, final SessionImplementor session,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final LockMode[] lockModesArray, final LockMode[] lockModesArray,
final EntityKey optionalObjectKey, final EntityKey optionalObjectKey,
final List hydratedObjects, final List hydratedObjects,
final EntityKey[] keys, final EntityKey[] keys,
boolean returnProxies, boolean returnProxies,
ResultTransformer forcedResultTransformer) throws SQLException, HibernateException { ResultTransformer forcedResultTransformer) throws SQLException, HibernateException {
final Loadable[] persisters = getEntityPersisters(); final Loadable[] persisters = getEntityPersisters();
final int entitySpan = persisters.length; final int entitySpan = persisters.length;
extractKeysFromResultSet( persisters, queryParameters, resultSet, session, keys, lockModesArray, hydratedObjects ); extractKeysFromResultSet( persisters, queryParameters, resultSet, session, keys, lockModesArray, hydratedObjects );
@ -723,7 +723,7 @@ public abstract class Loader {
// this call is side-effecty // this call is side-effecty
Object[] row = getRow( Object[] row = getRow(
resultSet, resultSet,
persisters, persisters,
keys, keys,
queryParameters.getOptionalObject(), queryParameters.getOptionalObject(),
@ -947,8 +947,8 @@ public abstract class Loader {
int count; int count;
for ( count = 0; count < maxRows && rs.next(); count++ ) { for ( count = 0; count < maxRows && rs.next(); count++ ) {
if ( DEBUG_ENABLED ) if ( DEBUG_ENABLED )
LOG.debugf( "Result set row: %s", count ); LOG.debugf( "Result set row: %s", count );
Object result = getRowFromResultSet( Object result = getRowFromResultSet(
rs, rs,
session, 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( initializeEntitiesAndCollections(
hydratedObjects, hydratedObjects,
@ -1110,8 +1109,7 @@ public abstract class Loader {
if ( hydratedObjects!=null ) { if ( hydratedObjects!=null ) {
int hydratedObjectsSize = hydratedObjects.size(); 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++ ) { for ( int i = 0; i < hydratedObjectsSize; i++ ) {
TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre ); TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre );
} }
@ -1222,9 +1220,9 @@ public abstract class Loader {
* session. * session.
*/ */
private void registerNonExists( private void registerNonExists(
final EntityKey[] keys, final EntityKey[] keys,
final Loadable[] persisters, final Loadable[] persisters,
final SessionImplementor session) { final SessionImplementor session) {
final int[] owners = getOwners(); final int[] owners = getOwners();
if ( owners != null ) { if ( owners != null ) {
@ -1284,12 +1282,12 @@ public abstract class Loader {
* Read one collection element from the current row of the JDBC result set * Read one collection element from the current row of the JDBC result set
*/ */
private void readCollectionElement( private void readCollectionElement(
final Object optionalOwner, final Object optionalOwner,
final Serializable optionalKey, final Serializable optionalKey,
final CollectionPersister persister, final CollectionPersister persister,
final CollectionAliases descriptor, final CollectionAliases descriptor,
final ResultSet rs, final ResultSet rs,
final SessionImplementor session) final SessionImplementor session)
throws HibernateException, SQLException { throws HibernateException, SQLException {
final PersistenceContext persistenceContext = session.getPersistenceContext(); final PersistenceContext persistenceContext = session.getPersistenceContext();
@ -1355,9 +1353,9 @@ public abstract class Loader {
* no elements (hence no rows in the result set). * no elements (hence no rows in the result set).
*/ */
private void handleEmptyCollections( private void handleEmptyCollections(
final Serializable[] keys, final Serializable[] keys,
final Object resultSetId, final Object resultSetId,
final SessionImplementor session) { final SessionImplementor session) {
if ( keys != null ) { if ( keys != null ) {
final boolean debugEnabled = LOG.isDebugEnabled(); final boolean debugEnabled = LOG.isDebugEnabled();
@ -1393,11 +1391,11 @@ public abstract class Loader {
* If an <tt>id</tt> is given, don't bother going to the <tt>ResultSet</tt>. * If an <tt>id</tt> is given, don't bother going to the <tt>ResultSet</tt>.
*/ */
private EntityKey getKeyFromResultSet( private EntityKey getKeyFromResultSet(
final int i, final int i,
final Loadable persister, final Loadable persister,
final Serializable id, final Serializable id,
final ResultSet rs, final ResultSet rs,
final SessionImplementor session) throws HibernateException, SQLException { final SessionImplementor session) throws HibernateException, SQLException {
Serializable resultId; Serializable resultId;
@ -1434,12 +1432,12 @@ public abstract class Loader {
* if the version numbers are different * if the version numbers are different
*/ */
private void checkVersion( private void checkVersion(
final int i, final int i,
final Loadable persister, final Loadable persister,
final Serializable id, final Serializable id,
final Object entity, final Object entity,
final ResultSet rs, final ResultSet rs,
final SessionImplementor session) final SessionImplementor session)
throws HibernateException, SQLException { throws HibernateException, SQLException {
Object version = session.getPersistenceContext().getEntry( entity ).getVersion(); Object version = session.getPersistenceContext().getEntry( entity ).getVersion();
@ -1471,14 +1469,14 @@ public abstract class Loader {
* object should be initialized. * object should be initialized.
*/ */
private Object[] getRow( private Object[] getRow(
final ResultSet rs, final ResultSet rs,
final Loadable[] persisters, final Loadable[] persisters,
final EntityKey[] keys, final EntityKey[] keys,
final Object optionalObject, final Object optionalObject,
final EntityKey optionalObjectKey, final EntityKey optionalObjectKey,
final LockMode[] lockModes, final LockMode[] lockModes,
final List hydratedObjects, final List hydratedObjects,
final SessionImplementor session) final SessionImplementor session)
throws HibernateException, SQLException { throws HibernateException, SQLException {
final int cols = persisters.length; final int cols = persisters.length;
@ -1541,12 +1539,12 @@ public abstract class Loader {
*/ */
private void instanceAlreadyLoaded( private void instanceAlreadyLoaded(
final ResultSet rs, final ResultSet rs,
final int i, final int i,
final Loadable persister, final Loadable persister,
final EntityKey key, final EntityKey key,
final Object object, final Object object,
final LockMode requestedLockMode, final LockMode requestedLockMode,
final SessionImplementor session) final SessionImplementor session)
throws HibernateException, SQLException { throws HibernateException, SQLException {
if ( !persister.isInstance( object ) ) { if ( !persister.isInstance( object ) ) {
throw new WrongClassException( throw new WrongClassException(
@ -1574,16 +1572,16 @@ public abstract class Loader {
* The entity instance is not in the session cache * The entity instance is not in the session cache
*/ */
private Object instanceNotYetLoaded( private Object instanceNotYetLoaded(
final ResultSet rs, final ResultSet rs,
final int i, final int i,
final Loadable persister, final Loadable persister,
final String rowIdAlias, final String rowIdAlias,
final EntityKey key, final EntityKey key,
final LockMode lockMode, final LockMode lockMode,
final EntityKey optionalObjectKey, final EntityKey optionalObjectKey,
final Object optionalObject, final Object optionalObject,
final List hydratedObjects, final List hydratedObjects,
final SessionImplementor session) final SessionImplementor session)
throws HibernateException, SQLException { throws HibernateException, SQLException {
final String instanceClass = getInstanceClass( final String instanceClass = getInstanceClass(
rs, rs,
@ -1656,15 +1654,15 @@ public abstract class Loader {
* and pass the hydrates state to the session. * and pass the hydrates state to the session.
*/ */
private void loadFromResultSet( private void loadFromResultSet(
final ResultSet rs, final ResultSet rs,
final int i, final int i,
final Object object, final Object object,
final String instanceEntityName, final String instanceEntityName,
final EntityKey key, final EntityKey key,
final String rowIdAlias, final String rowIdAlias,
final LockMode lockMode, final LockMode lockMode,
final Loadable rootPersister, final Loadable rootPersister,
final SessionImplementor session) final SessionImplementor session)
throws SQLException, HibernateException { throws SQLException, HibernateException {
final Serializable id = key.getIdentifier(); final Serializable id = key.getIdentifier();
@ -1985,10 +1983,10 @@ public abstract class Loader {
* @throws org.hibernate.HibernateException Indicates problems delegating binding to the types. * @throws org.hibernate.HibernateException Indicates problems delegating binding to the types.
*/ */
protected int bindPositionalParameters( protected int bindPositionalParameters(
final PreparedStatement statement, final PreparedStatement statement,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final int startIndex, final int startIndex,
final SessionImplementor session) throws SQLException, HibernateException { final SessionImplementor session) throws SQLException, HibernateException {
final Object[] values = queryParameters.getFilteredPositionalParameterValues(); final Object[] values = queryParameters.getFilteredPositionalParameterValues();
final Type[] types = queryParameters.getFilteredPositionalParameterTypes(); final Type[] types = queryParameters.getFilteredPositionalParameterTypes();
int span = 0; int span = 0;
@ -2056,11 +2054,11 @@ public abstract class Loader {
* Execute given <tt>PreparedStatement</tt>, advance to the first result and return SQL <tt>ResultSet</tt>. * Execute given <tt>PreparedStatement</tt>, advance to the first result and return SQL <tt>ResultSet</tt>.
*/ */
protected final ResultSet getResultSet( protected final ResultSet getResultSet(
final PreparedStatement st, final PreparedStatement st,
final RowSelection selection, final RowSelection selection,
final LimitHandler limitHandler, final LimitHandler limitHandler,
final boolean autodiscovertypes, final boolean autodiscovertypes,
final SessionImplementor session) final SessionImplementor session)
throws SQLException, HibernateException { throws SQLException, HibernateException {
try { try {
@ -2092,8 +2090,7 @@ public abstract class Loader {
// potential deadlock issues due to nature of code. // potential deadlock issues due to nature of code.
if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) { if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) {
try { try {
if ( LOG.isDebugEnabled() ) LOG.debugf( "Wrapping result set [%s]", rs );
LOG.debugf( "Wrapping result set [%s]", rs );
return session.getFactory() return session.getFactory()
.getJdbcServices() .getJdbcServices()
.getResultSetWrapper().wrap( rs, retreiveColumnNameToIndexCache( rs ) ); .getResultSetWrapper().wrap( rs, retreiveColumnNameToIndexCache( rs ) );
@ -2285,9 +2282,9 @@ public abstract class Loader {
* Called by wrappers that batch initialize collections * Called by wrappers that batch initialize collections
*/ */
public final void loadCollectionBatch( public final void loadCollectionBatch(
final SessionImplementor session, final SessionImplementor session,
final Serializable[] ids, final Serializable[] ids,
final Type type) throws HibernateException { final Type type) throws HibernateException {
if ( LOG.isDebugEnabled() ) if ( LOG.isDebugEnabled() )
LOG.debugf( "Batch loading collection: %s", LOG.debugf( "Batch loading collection: %s",
@ -2304,10 +2301,10 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not initialize a collection batch: " + "could not initialize a collection batch: " +
MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ), MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ),
getSQLString() getSQLString()
); );
} }
@ -2319,12 +2316,12 @@ public abstract class Loader {
* Called by subclasses that batch initialize collections * Called by subclasses that batch initialize collections
*/ */
protected final void loadCollectionSubselect( protected final void loadCollectionSubselect(
final SessionImplementor session, final SessionImplementor session,
final Serializable[] ids, final Serializable[] ids,
final Object[] parameterValues, final Object[] parameterValues,
final Type[] parameterTypes, final Type[] parameterTypes,
final Map<String, TypedValue> namedParameters, final Map<String, TypedValue> namedParameters,
final Type type) throws HibernateException { final Type type) throws HibernateException {
Type[] idTypes = new Type[ids.length]; Type[] idTypes = new Type[ids.length];
Arrays.fill( idTypes, type ); Arrays.fill( idTypes, type );
@ -2336,10 +2333,10 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not load collection by subselect: " + "could not load collection by subselect: " +
MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ), MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ),
getSQLString() getSQLString()
); );
} }
} }
@ -2349,10 +2346,10 @@ public abstract class Loader {
* by subclasses that implement cacheable queries * by subclasses that implement cacheable queries
*/ */
protected List list( protected List list(
final SessionImplementor session, final SessionImplementor session,
final QueryParameters queryParameters, final QueryParameters queryParameters,
final Set<Serializable> querySpaces, final Set<Serializable> querySpaces,
final Type[] resultTypes) throws HibernateException { final Type[] resultTypes) throws HibernateException {
final boolean cacheable = factory.getSettings().isQueryCacheEnabled() && final boolean cacheable = factory.getSettings().isQueryCacheEnabled() &&
queryParameters.isCacheable(); queryParameters.isCacheable();
@ -2554,9 +2551,9 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not execute query", "could not execute query",
getSQLString() getSQLString()
); );
} }
@ -2606,10 +2603,10 @@ public abstract class Loader {
* the ScrollableResults. * the ScrollableResults.
*/ */
protected ScrollableResults scroll( protected ScrollableResults scroll(
final QueryParameters queryParameters, final QueryParameters queryParameters,
final Type[] returnTypes, final Type[] returnTypes,
final HolderInstantiator holderInstantiator, final HolderInstantiator holderInstantiator,
final SessionImplementor session) throws HibernateException { final SessionImplementor session) throws HibernateException {
checkScrollability(); checkScrollability();
@ -2659,9 +2656,9 @@ public abstract class Loader {
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert( throw factory.getSQLExceptionHelper().convert(
sqle, sqle,
"could not execute query using scroll", "could not execute query using scroll",
getSQLString() getSQLString()
); );
} }
@ -2693,7 +2690,7 @@ public abstract class Loader {
} }
@Override @Override
public String toString() { public String toString() {
return getClass().getName() + '(' + getSQLString() + ')'; return getClass().getName() + '(' + getSQLString() + ')';
} }

View File

@ -82,7 +82,6 @@ import org.hibernate.engine.spi.PersistenceContext.NaturalIdHelper;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.ValueInclusion; import org.hibernate.engine.spi.ValueInclusion;
import org.hibernate.event.spi.EventSource;
import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.PostInsertIdentifierGenerator; import org.hibernate.id.PostInsertIdentifierGenerator;
import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.id.PostInsertIdentityPersister;
@ -151,10 +150,9 @@ import org.jboss.logging.Logger;
*/ */
public abstract class AbstractEntityPersister public abstract class AbstractEntityPersister
implements OuterJoinLoadable, Queryable, ClassMetadata, UniqueKeyLoadable, implements OuterJoinLoadable, Queryable, ClassMetadata, UniqueKeyLoadable,
SQLLoadable, LazyPropertyInitializer, PostInsertIdentityPersister, Lockable { SQLLoadable, LazyPropertyInitializer, PostInsertIdentityPersister, Lockable {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, AbstractEntityPersister.class.getName() );
AbstractEntityPersister.class.getName());
public static final String ENTITY_CLASS = "class"; public static final String ENTITY_CLASS = "class";
@ -2155,19 +2153,18 @@ public abstract class AbstractEntityPersister
return subclassPropertyNameClosure; return subclassPropertyNameClosure;
} }
@Override @Override
public int[] resolveAttributeIndexes(Set<String> properties) { public int[] resolveAttributeIndexes(Set<String> properties) {
Iterator<String> iter = properties.iterator(); Iterator<String> iter = properties.iterator();
int[] fields = new int[properties.size()]; int[] fields = new int[properties.size()];
int counter = 0; int counter = 0;
while(iter.hasNext()) { while(iter.hasNext()) {
Integer index = entityMetamodel.getPropertyIndexOrNull(iter.next()); Integer index = entityMetamodel.getPropertyIndexOrNull( iter.next() );
if(index != null) if ( index != null )
fields[counter++] = index; fields[counter++] = index;
} }
return fields;
return fields; }
}
protected String[] getSubclassPropertySubclassNameClosure() { protected String[] getSubclassPropertySubclassNameClosure() {
return subclassPropertySubclassNameClosure; return subclassPropertySubclassNameClosure;
@ -2650,7 +2647,7 @@ public abstract class AbstractEntityPersister
} }
private boolean checkVersion(final boolean[] includeProperty) { private boolean checkVersion(final boolean[] includeProperty) {
return includeProperty[ getVersionProperty() ] return includeProperty[ getVersionProperty() ]
|| entityMetamodel.isVersionGenerated(); || entityMetamodel.isVersionGenerated();
} }
@ -2825,15 +2822,15 @@ public abstract class AbstractEntityPersister
*/ */
protected int dehydrate( protected int dehydrate(
final Serializable id, final Serializable id,
final Object[] fields, final Object[] fields,
final Object rowId, final Object rowId,
final boolean[] includeProperty, final boolean[] includeProperty,
final boolean[][] includeColumns, final boolean[][] includeColumns,
final int j, final int j,
final PreparedStatement ps, final PreparedStatement ps,
final SessionImplementor session, final SessionImplementor session,
int index, int index,
boolean isUpdate ) throws SQLException, HibernateException { boolean isUpdate ) throws SQLException, HibernateException {
if ( LOG.isTraceEnabled() ) { if ( LOG.isTraceEnabled() ) {
LOG.tracev( "Dehydrating entity: {0}", MessageHelper.infoString( this, id, getFactory() ) ); LOG.tracev( "Dehydrating entity: {0}", MessageHelper.infoString( this, id, getFactory() ) );
@ -2873,7 +2870,7 @@ public abstract class AbstractEntityPersister
final Serializable id, final Serializable id,
final Object rowId, final Object rowId,
final PreparedStatement ps, final PreparedStatement ps,
final SessionImplementor session, final SessionImplementor session,
int index ) throws SQLException { int index ) throws SQLException {
if ( rowId != null ) { if ( rowId != null ) {
ps.setObject( index, rowId ); ps.setObject( index, rowId );
@ -2892,12 +2889,12 @@ public abstract class AbstractEntityPersister
*/ */
public Object[] hydrate( public Object[] hydrate(
final ResultSet rs, final ResultSet rs,
final Serializable id, final Serializable id,
final Object object, final Object object,
final Loadable rootLoadable, final Loadable rootLoadable,
final String[][] suffixedPropertyColumns, final String[][] suffixedPropertyColumns,
final boolean allProperties, final boolean allProperties,
final SessionImplementor session) throws SQLException, HibernateException { final SessionImplementor session) throws SQLException, HibernateException {
if ( LOG.isTraceEnabled() ) { if ( LOG.isTraceEnabled() ) {
LOG.tracev( "Hydrating entity: {0}", MessageHelper.infoString( this, id, getFactory() ) ); LOG.tracev( "Hydrating entity: {0}", MessageHelper.infoString( this, id, getFactory() ) );
@ -3010,10 +3007,10 @@ public abstract class AbstractEntityPersister
*/ */
protected Serializable insert( protected Serializable insert(
final Object[] fields, final Object[] fields,
final boolean[] notNull, final boolean[] notNull,
String sql, String sql,
final Object object, final Object object,
final SessionImplementor session) throws HibernateException { final SessionImplementor session) throws HibernateException {
if ( LOG.isTraceEnabled() ) { if ( LOG.isTraceEnabled() ) {
LOG.tracev( "Inserting entity: {0} (native id)", getEntityName() ); LOG.tracev( "Inserting entity: {0} (native id)", getEntityName() );
@ -3061,12 +3058,12 @@ public abstract class AbstractEntityPersister
*/ */
protected void insert( protected void insert(
final Serializable id, final Serializable id,
final Object[] fields, final Object[] fields,
final boolean[] notNull, final boolean[] notNull,
final int j, final int j,
final String sql, final String sql,
final Object object, final Object object,
final SessionImplementor session) throws HibernateException { final SessionImplementor session) throws HibernateException {
if ( isInverseTable( j ) ) { if ( isInverseTable( j ) ) {
return; return;
@ -3157,15 +3154,15 @@ public abstract class AbstractEntityPersister
*/ */
protected void updateOrInsert( protected void updateOrInsert(
final Serializable id, final Serializable id,
final Object[] fields, final Object[] fields,
final Object[] oldFields, final Object[] oldFields,
final Object rowId, final Object rowId,
final boolean[] includeProperty, final boolean[] includeProperty,
final int j, final int j,
final Object oldVersion, final Object oldVersion,
final Object object, final Object object,
final String sql, final String sql,
final SessionImplementor session) throws HibernateException { final SessionImplementor session) throws HibernateException {
if ( !isInverseTable( j ) ) { if ( !isInverseTable( j ) ) {
@ -3200,15 +3197,15 @@ public abstract class AbstractEntityPersister
protected boolean update( protected boolean update(
final Serializable id, final Serializable id,
final Object[] fields, final Object[] fields,
final Object[] oldFields, final Object[] oldFields,
final Object rowId, final Object rowId,
final boolean[] includeProperty, final boolean[] includeProperty,
final int j, final int j,
final Object oldVersion, final Object oldVersion,
final Object object, final Object object,
final String sql, final String sql,
final SessionImplementor session) throws HibernateException { final SessionImplementor session) throws HibernateException {
final Expectation expectation = Expectations.appropriateExpectation( updateResultCheckStyles[j] ); final Expectation expectation = Expectations.appropriateExpectation( updateResultCheckStyles[j] );
final boolean useBatch = j == 0 && expectation.canBeBatched() && isBatchable(); //note: updates to joined tables can't be batched... 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( public void update(
final Serializable id, final Serializable id,
final Object[] fields, final Object[] fields,
final int[] dirtyFields, final int[] dirtyFields,
final boolean hasDirtyCollection, final boolean hasDirtyCollection,
final Object[] oldFields, final Object[] oldFields,
final Object oldVersion, final Object oldVersion,
final Object object, final Object object,
final Object rowId, final Object rowId,
final SessionImplementor session) throws HibernateException { final SessionImplementor session) throws HibernateException {
// apply any pre-update in-memory value generation // apply any pre-update in-memory value generation
if ( getEntityMetamodel().hasPreUpdateGeneratedValues() ) { if ( getEntityMetamodel().hasPreUpdateGeneratedValues() ) {

View File

@ -773,7 +773,7 @@ public interface EntityPersister extends OptimisticCacheSource, EntityDefinition
public FilterAliasGenerator getFilterAliasGenerator(final String rootAlias); public FilterAliasGenerator getFilterAliasGenerator(final String rootAlias);
public int[] resolveAttributeIndexes(Set<String> properties); public int[] resolveAttributeIndexes(Set<String> properties);
public boolean canUseReferenceCacheEntries(); public boolean canUseReferenceCacheEntries();
} }