diff --git a/hibernate-core/src/main/java/org/hibernate/CacheMode.java b/hibernate-core/src/main/java/org/hibernate/CacheMode.java index 43d381e88f..91e8848a01 100755 --- a/hibernate-core/src/main/java/org/hibernate/CacheMode.java +++ b/hibernate-core/src/main/java/org/hibernate/CacheMode.java @@ -84,22 +84,11 @@ public enum CacheMode { return null; } - if ( GET.name().equalsIgnoreCase( setting ) ) { - return CacheMode.GET; + try { + return CacheMode.valueOf( setting.toUpperCase() ); } - if ( IGNORE.name().equalsIgnoreCase( setting ) ) { - return CacheMode.IGNORE; + catch ( IllegalArgumentException e ) { + throw new MappingException( "Unknown Cache Mode: " + setting ); } - if ( NORMAL.name().equalsIgnoreCase( setting ) ) { - return CacheMode.NORMAL; - } - if ( PUT.name().equalsIgnoreCase( setting ) ) { - return CacheMode.PUT; - } - if ( REFRESH.name().equalsIgnoreCase( setting ) ) { - return CacheMode.REFRESH; - } - - throw new MappingException( "Unknown Cache Mode: " + setting ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/FlushMode.java b/hibernate-core/src/main/java/org/hibernate/FlushMode.java index 7c223f0731..f3f886f1b9 100644 --- a/hibernate-core/src/main/java/org/hibernate/FlushMode.java +++ b/hibernate-core/src/main/java/org/hibernate/FlushMode.java @@ -89,22 +89,11 @@ public enum FlushMode { return null; } - if ( AUTO.name().equalsIgnoreCase( setting ) ) { - return FlushMode.AUTO; + try { + return FlushMode.valueOf( setting.toUpperCase() ); } - if ( COMMIT.name().equalsIgnoreCase( setting ) ) { - return FlushMode.COMMIT; + catch ( IllegalArgumentException e ) { + throw new MappingException( "unknown FlushMode : " + setting ); } - if ( NEVER.name().equalsIgnoreCase( setting ) ) { - return FlushMode.NEVER; - } - if ( MANUAL.name().equalsIgnoreCase( setting ) ) { - return FlushMode.MANUAL; - } - if ( ALWAYS.name().equalsIgnoreCase( setting ) ) { - return FlushMode.ALWAYS; - } - - throw new MappingException( "unknown FlushMode : " + setting ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/instrumentation/internal/javassist/FieldInterceptorImpl.java b/hibernate-core/src/main/java/org/hibernate/bytecode/instrumentation/internal/javassist/FieldInterceptorImpl.java index c593a53e75..4e245b5fdc 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/instrumentation/internal/javassist/FieldInterceptorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/instrumentation/internal/javassist/FieldInterceptorImpl.java @@ -81,8 +81,7 @@ public final class FieldInterceptorImpl extends AbstractFieldInterceptor impleme } public int readInt(Object target, String name, int oldValue) { - return ( ( Integer ) intercept( target, name, Integer.valueOf( oldValue ) ) ) - .intValue(); + return ( ( Integer ) intercept( target, name, Integer.valueOf( oldValue ) ) ); } public long readLong(Object target, String name, long oldValue) { diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentArrayHolder.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentArrayHolder.java index 36ceae439b..9ddd1d21aa 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentArrayHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentArrayHolder.java @@ -134,7 +134,7 @@ public class PersistentArrayHolder extends AbstractPersistentCollection { throws HibernateException, SQLException { Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() ); - int index = ( (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() ) ).intValue(); + int index = (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() ); for ( int i = tempList.size(); i<=index; i++) { tempList.add(i, null); } @@ -205,7 +205,7 @@ public class PersistentArrayHolder extends AbstractPersistentCollection { } public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException { - java.util.List deletes = new ArrayList(); + java.util.List deletes = new ArrayList(); Serializable sn = getSnapshot(); int snSize = Array.getLength(sn); int arraySize = Array.getLength(array); diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java index 12b4a34330..e9b211cb2e 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentList.java @@ -397,7 +397,7 @@ public class PersistentList extends AbstractPersistentCollection implements List public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner) throws HibernateException, SQLException { Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() ) ; - int index = ( (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() ) ).intValue(); + int index = (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() ); //pad with nulls from the current last element up to the new index for ( int i = list.size(); i<=index; i++) { diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentListElementHolder.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentListElementHolder.java index 775ad15888..95cacefaed 100755 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentListElementHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentListElementHolder.java @@ -79,7 +79,7 @@ public class PersistentListElementHolder extends PersistentIndexedElementHolder Element elem = (Element) elements.get(i); Object object = elementType.fromXMLNode( elem, persister.getFactory() ); Integer index = IntegerType.INSTANCE.fromString( getIndex(elem, indexNodeName, i) ); - result[ index.intValue() ] = elementType.disassemble( object, getSession(), null ); + result[index] = elementType.disassemble( object, getSession(), null ); } return result; } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java index b3d36326d3..9e07608e96 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java @@ -354,7 +354,7 @@ public class PostgreSQL81Dialect extends Dialect { private static ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() { public String extractConstraintName(SQLException sqle) { try { - int sqlState = Integer.valueOf( JdbcExceptionHelper.extractSqlState( sqle )).intValue(); + int sqlState = Integer.valueOf( JdbcExceptionHelper.extractSqlState( sqle ) ); switch (sqlState) { // CHECK VIOLATION case 23514: return extractUsingTemplate("violates check constraint \"","\"", sqle.getMessage()); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/TemplateRenderer.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/TemplateRenderer.java index 68247fa9e3..d88f70cfe0 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/function/TemplateRenderer.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/TemplateRenderer.java @@ -84,7 +84,7 @@ public class TemplateRenderer { chunks = chunkList.toArray( new String[chunkList.size()] ); paramIndexes = new int[paramList.size()]; for ( int i = 0; i < paramIndexes.length; ++i ) { - paramIndexes[i] = paramList.get( i ).intValue(); + paramIndexes[i] = paramList.get( i ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ColumnNameCache.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ColumnNameCache.java index 7b5e5fbb2b..934e2c6c55 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ColumnNameCache.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ColumnNameCache.java @@ -45,7 +45,7 @@ public class ColumnNameCache { public int getIndexForColumnName(String columnName, ResultSet rs) throws SQLException { Integer cached = columnNameToIndexCache.get( columnName ); if ( cached != null ) { - return cached.intValue(); + return cached; } else { int index = rs.findColumn( columnName ); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/cursor/internal/StandardRefCursorSupport.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/cursor/internal/StandardRefCursorSupport.java index 93f3e6a9de..3e83be53c0 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/cursor/internal/StandardRefCursorSupport.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/cursor/internal/StandardRefCursorSupport.java @@ -192,7 +192,7 @@ public class StandardRefCursorSupport implements RefCursorSupport { throw new HibernateException( "Unexpected error trying to determine REF_CURSOR field value : " + e.getMessage() ); } } - return refCursorTypeCode.intValue(); + return refCursorTypeCode; } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java index 38e07eb0f6..0b2babef47 100755 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java @@ -336,7 +336,7 @@ public class BasicFormatterImpl implements Formatter { parensSinceSelect--; if ( parensSinceSelect < 0 ) { indent--; - parensSinceSelect = parenCounts.removeLast().intValue(); + parensSinceSelect = parenCounts.removeLast(); afterByOrSetOrFromOrSelect = afterByOrFromOrSelects.removeLast().booleanValue(); } if ( inFunction > 0 ) { diff --git a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/NativeSQLQueryPlan.java b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/NativeSQLQueryPlan.java index 6fdbd0bb78..f511b444c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/NativeSQLQueryPlan.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/NativeSQLQueryPlan.java @@ -87,7 +87,7 @@ public class NativeSQLQueryPlan implements Serializable { customQuery.getSQL() ); } if ( loc instanceof Integer ) { - return new int[] { ((Integer) loc ).intValue() }; + return new int[] { (Integer) loc }; } else { return ArrayHelper.toIntArray( (List) loc ); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/RowSelection.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/RowSelection.java index 3c633decc5..964a15fec4 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/RowSelection.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/RowSelection.java @@ -68,6 +68,6 @@ public final class RowSelection { public boolean definesLimits() { return maxRows != null || - ( firstRow != null && firstRow.intValue() <= 0 ); + ( firstRow != null && firstRow <= 0 ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/HqlSqlWalker.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/HqlSqlWalker.java index d2c6ada9bc..2c3beb7f74 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/HqlSqlWalker.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/HqlSqlWalker.java @@ -137,7 +137,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par * Maps each top-level result variable to its SelectExpression; * (excludes result variables defined in subqueries) **/ - private Map selectExpressionsByResultVariable = new HashMap(); + private Map selectExpressionsByResultVariable = new HashMap(); private Set querySpaces = new HashSet(); @@ -492,8 +492,8 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par private void applyParameterSpecifications(ParameterContainer parameterContainer) { if ( parameterContainer.hasEmbeddedParameters() ) { ParameterSpecification[] specs = parameterContainer.getEmbeddedParameters(); - for ( int i = 0; i < specs.length; i++ ) { - applyParameterSpecification( specs[i] ); + for ( ParameterSpecification spec : specs ) { + applyParameterSpecification( spec ); } } } @@ -1064,7 +1064,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par throw qe; } if ( o instanceof Integer ) { - return new int[]{( ( Integer ) o ).intValue()}; + return new int[]{ (Integer) o }; } else { return ArrayHelper.toIntArray( (ArrayList) o ); diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java index 15c6fc29e6..71670bd6f5 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java @@ -359,15 +359,13 @@ public class QueryTranslatorImpl implements FilterTranslator { // NOTE : firstRow is zero-based int first = !hasLimit || queryParameters.getRowSelection().getFirstRow() == null ? 0 - : queryParameters.getRowSelection().getFirstRow().intValue(); + : queryParameters.getRowSelection().getFirstRow(); int max = !hasLimit || queryParameters.getRowSelection().getMaxRows() == null ? -1 - : queryParameters.getRowSelection().getMaxRows().intValue(); - int size = results.size(); + : queryParameters.getRowSelection().getMaxRows(); List tmp = new ArrayList(); IdentitySet distinction = new IdentitySet(); - for ( int i = 0; i < size; i++ ) { - final Object result = results.get( i ); + for ( final Object result : results ) { if ( !distinction.add( result ) ) { continue; } diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/exec/BasicExecutor.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/exec/BasicExecutor.java index 2c2aeaf164..3b6efb8862 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/exec/BasicExecutor.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/exec/BasicExecutor.java @@ -96,7 +96,7 @@ public class BasicExecutor implements StatementExecutor { } if ( selection != null ) { if ( selection.getTimeout() != null ) { - st.setQueryTimeout( selection.getTimeout().intValue() ); + st.setQueryTimeout( selection.getTimeout() ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/ASTUtil.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/ASTUtil.java index c0bfc3a261..167bf0bb6c 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/ASTUtil.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/ASTUtil.java @@ -384,8 +384,7 @@ public final class ASTUtil { public static Map generateTokenNameCache(Class tokenTypeInterface) { final Field[] fields = tokenTypeInterface.getFields(); Map cache = new HashMap( (int)( fields.length * .75 ) + 1 ); - for ( int i = 0; i < fields.length; i++ ) { - final Field field = fields[i]; + for ( final Field field : fields ) { if ( Modifier.isStatic( field.getModifiers() ) ) { try { cache.put( field.get( null ), field.getName() ); @@ -429,10 +428,10 @@ public final class ASTUtil { String tokenTypeName = Integer.toString( tokenType ); if ( tokenTypeInterface != null ) { Field[] fields = tokenTypeInterface.getFields(); - for ( int i = 0; i < fields.length; i++ ) { - final Integer fieldValue = extractIntegerValue( fields[i] ); - if ( fieldValue != null && fieldValue.intValue() == tokenType ) { - tokenTypeName = fields[i].getName(); + for ( Field field : fields ) { + final Integer fieldValue = extractIntegerValue( field ); + if ( fieldValue != null && fieldValue == tokenType ) { + tokenTypeName = field.getName(); break; } } @@ -451,7 +450,7 @@ public final class ASTUtil { rtn = ( ( Short ) value ).intValue(); } else if ( value instanceof Long ) { - if ( ( ( Long ) value ).longValue() <= Integer.MAX_VALUE ) { + if ( ( Long ) value <= Integer.MAX_VALUE ) { rtn = ( ( Long ) value ).intValue(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java index 6d5362fa5d..f81f21930e 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java @@ -550,9 +550,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator qe.setQueryString( queryString ); throw qe; } - if ( o instanceof Integer ) { - return new int[]{ ( ( Integer ) o ).intValue() }; - } + if ( o instanceof Integer ) return new int[] { (Integer) o }; else { return ArrayHelper.toIntArray( ( ArrayList ) o ); } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java index d0e75b1dc1..dc3b16bca2 100755 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java @@ -192,10 +192,10 @@ public abstract class AbstractSessionImpl implements Serializable, SharedSession query.setReadOnly( nqd.isReadOnly() ); if ( nqd.getTimeout() != null ) { - query.setTimeout( nqd.getTimeout().intValue() ); + query.setTimeout( nqd.getTimeout() ); } if ( nqd.getFetchSize() != null ) { - query.setFetchSize( nqd.getFetchSize().intValue() ); + query.setFetchSize( nqd.getFetchSize() ); } if ( nqd.getCacheMode() != null ) { query.setCacheMode( nqd.getCacheMode() ); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/FetchingScrollableResultsImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/FetchingScrollableResultsImpl.java index cb34b9129a..62dcf63a7a 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/FetchingScrollableResultsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/FetchingScrollableResultsImpl.java @@ -67,9 +67,9 @@ public class FetchingScrollableResultsImpl extends AbstractScrollableResults { * @return true if there is another result */ public boolean next() throws HibernateException { - if ( maxPosition != null && maxPosition.intValue() <= currentPosition ) { + if ( maxPosition != null && maxPosition <= currentPosition ) { currentRow = null; - currentPosition = maxPosition.intValue() + 1; + currentPosition = maxPosition + 1; return false; } @@ -130,7 +130,7 @@ public class FetchingScrollableResultsImpl extends AbstractScrollableResults { getSession(), getQueryParameters(), false, - ( maxPosition != null && currentPosition > maxPosition.intValue() ) + ( maxPosition != null && currentPosition > maxPosition ) ); currentRow = new Object[] { loadResult }; @@ -186,10 +186,10 @@ public class FetchingScrollableResultsImpl extends AbstractScrollableResults { public boolean last() throws HibernateException { boolean more = false; if ( maxPosition != null ) { - if ( currentPosition > maxPosition.intValue() ) { + if ( currentPosition > maxPosition ) { more = previous(); } - for ( int i = currentPosition; i < maxPosition.intValue(); i++ ) { + for ( int i = currentPosition; i < maxPosition; i++ ) { more = next(); } } @@ -284,7 +284,7 @@ public class FetchingScrollableResultsImpl extends AbstractScrollableResults { return false; } else { - return currentPosition == maxPosition.intValue(); + return currentPosition == maxPosition; } } @@ -312,7 +312,7 @@ public class FetchingScrollableResultsImpl extends AbstractScrollableResults { else if ( rowNumber == -1 ) { return last(); } - else if ( maxPosition != null && rowNumber == maxPosition.intValue() ) { + else if ( maxPosition != null && rowNumber == maxPosition ) { return last(); } return scroll( rowNumber - currentPosition ); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java index f43e35b6b4..c9a9551b19 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java @@ -113,7 +113,7 @@ public final class ArrayHelper { int[] arr = new int[ coll.size() ]; int i=0; while( iter.hasNext() ) { - arr[i++] = ( (Integer) iter.next() ).intValue(); + arr[i++] = (Integer) iter.next(); } return arr; } @@ -123,7 +123,7 @@ public final class ArrayHelper { boolean[] arr = new boolean[ coll.size() ]; int i=0; while( iter.hasNext() ) { - arr[i++] = ( (Boolean) iter.next() ).booleanValue(); + arr[i++] = (Boolean) iter.next(); } return arr; } @@ -214,23 +214,29 @@ public final class ArrayHelper { } public static boolean isAllNegative(int[] array) { - for ( int i=0; i=0 ) return false; + for ( int anArray : array ) { + if ( anArray >= 0 ) { + return false; + } } return true; } public static boolean isAllTrue(boolean[] array) { - for ( int i=0; i= maxFetchDepth.intValue(); + return maxFetchDepth!=null && currentDepth >= maxFetchDepth; } protected boolean isTooManyCollections() { @@ -841,7 +841,7 @@ public class JoinWalker { } Integer maxFetchDepth = getFactory().getSettings().getMaximumFetchDepth(); - final boolean tooDeep = maxFetchDepth!=null && depth >= maxFetchDepth.intValue(); + final boolean tooDeep = maxFetchDepth!=null && depth >= maxFetchDepth; return !tooDeep && !isDuplicateAssociation(lhsTable, lhsColumnNames, type); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index a42c753a45..04c388e400 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -807,7 +807,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { if ( index == null ) { return null; } - return tableNames[propertyTableNumbers[index.intValue()]]; + return tableNames[propertyTableNumbers[index]]; } public String[] getConstraintOrderedTableNameClosure() { diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java index fe0fe3da13..e66822ed56 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java @@ -927,7 +927,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { Type type = propertyMapping.toType(propertyName); if ( type.isAssociationType() && ( (AssociationType) type ).useLHSPrimaryKey() ) return 0; final Integer tabnum = (Integer) propertyTableNumbersByNameAndSubclass.get(entityName + '.' + propertyName); - return tabnum==null ? 0 : tabnum.intValue(); + return tabnum==null ? 0 : tabnum; } protected String getSequentialSelect(String entityName) { @@ -1011,7 +1011,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { public String getPropertyTableName(String propertyName) { Integer index = getEntityMetamodel().getPropertyIndexOrNull(propertyName); if (index==null) return null; - return qualifiedTableNames[ propertyTableNumbers[ index.intValue() ] ]; + return qualifiedTableNames[ propertyTableNumbers[index] ]; } public void postInstantiate() { diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentMetamodel.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentMetamodel.java index ae97415678..2de23be05a 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentMetamodel.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentMetamodel.java @@ -107,7 +107,7 @@ public class ComponentMetamodel implements Serializable { if ( index == null ) { throw new HibernateException( "component does not contain such a property [" + propertyName + "]" ); } - return index.intValue(); + return index; } public StandardProperty getProperty(String propertyName) { diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java index 4ad31ed08f..d82567ac21 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java @@ -645,13 +645,13 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer { : propertyPath; } index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); - final Object baseValue = getPropertyValue( entity, index.intValue() ); + final Object baseValue = getPropertyValue( entity, index ); if ( loc > 0 ) { if ( baseValue == null ) { return null; } return getComponentValue( - (ComponentType) entityMetamodel.getPropertyTypes()[index.intValue()], + (ComponentType) entityMetamodel.getPropertyTypes()[index], baseValue, propertyPath.substring(loc+1) ); diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java index 991c91e39b..ac2d02a4d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java @@ -791,7 +791,7 @@ public class EntityMetamodel implements Serializable { if ( index == null ) { throw new HibernateException("Unable to resolve property: " + propertyName); } - return index.intValue(); + return index; } public Integer getPropertyIndexOrNull(String propertyName) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/IntegerType.java b/hibernate-core/src/main/java/org/hibernate/type/IntegerType.java index a3b9f5a31a..5a83d9b298 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/IntegerType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/IntegerType.java @@ -79,7 +79,7 @@ public class IntegerType extends AbstractSingleColumnStandardBasicType @SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" }) public Integer next(Integer current, SessionImplementor session) { - return Integer.valueOf( current.intValue() + 1 ); + return current+1; } public Comparator getComparator() { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/JdbcTypeJavaClassMappings.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/JdbcTypeJavaClassMappings.java index 05bf217c34..d7dd1c7cbd 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/JdbcTypeJavaClassMappings.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/JdbcTypeJavaClassMappings.java @@ -62,7 +62,7 @@ public class JdbcTypeJavaClassMappings { public int determineJdbcTypeCodeForJavaClass(Class cls) { Integer typeCode = JdbcTypeJavaClassMappings.javaClassToJdbcTypeCodeMap.get( cls ); if ( typeCode != null ) { - return typeCode.intValue(); + return typeCode; } int specialCode = cls.hashCode();