HHH-8211 Checkstyle and FindBugs fix-ups
This commit is contained in:
parent
0433a539b4
commit
1825a4762c
|
@ -46,7 +46,6 @@ import org.hibernate.proxy.LazyInitializer;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing", "UnnecessaryBoxing"})
|
||||
final class FieldInterceptorImpl extends AbstractFieldInterceptor implements FieldHandler, Serializable {
|
||||
|
||||
FieldInterceptorImpl(SessionImplementor session, Set uninitializedFields, String entityName) {
|
||||
|
@ -55,39 +54,39 @@ final class FieldInterceptorImpl extends AbstractFieldInterceptor implements Fie
|
|||
|
||||
|
||||
// FieldHandler impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@Override
|
||||
public boolean readBoolean(Object target, String name, boolean oldValue) {
|
||||
return ( (Boolean) intercept( target, name, oldValue ) ).booleanValue();
|
||||
return (Boolean) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte readByte(Object target, String name, byte oldValue) {
|
||||
return ( (Byte) intercept( target, name, Byte.valueOf( oldValue ) ) ).byteValue();
|
||||
return (Byte) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public char readChar(Object target, String name, char oldValue) {
|
||||
return ( (Character) intercept( target, name, Character.valueOf( oldValue ) ) ).charValue();
|
||||
return (Character) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double readDouble(Object target, String name, double oldValue) {
|
||||
return ( (Double) intercept( target, name, Double.valueOf( oldValue ) ) ).doubleValue();
|
||||
return (Double) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float readFloat(Object target, String name, float oldValue) {
|
||||
return ( (Float) intercept( target, name, Float.valueOf( oldValue ) ) ).floatValue();
|
||||
return (Float) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readInt(Object target, String name, int oldValue) {
|
||||
return ( (Integer) intercept( target, name, Integer.valueOf( oldValue ) ) );
|
||||
return (Integer) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public long readLong(Object target, String name, long oldValue) {
|
||||
return ( (Long) intercept( target, name, Long.valueOf( oldValue ) ) ).longValue();
|
||||
return (Long) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public short readShort(Object target, String name, short oldValue) {
|
||||
return ( (Short) intercept( target, name, Short.valueOf( oldValue ) ) ).shortValue();
|
||||
return (Short) intercept( target, name, oldValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object readObject(Object target, String name, Object oldValue) {
|
||||
Object value = intercept( target, name, oldValue );
|
||||
if ( value instanceof HibernateProxy ) {
|
||||
|
@ -98,61 +97,61 @@ final class FieldInterceptorImpl extends AbstractFieldInterceptor implements Fie
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeBoolean(Object target, String name, boolean oldValue, boolean newValue) {
|
||||
dirty();
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte writeByte(Object target, String name, byte oldValue, byte newValue) {
|
||||
dirty();
|
||||
intercept( target, name, Byte.valueOf( oldValue ) );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char writeChar(Object target, String name, char oldValue, char newValue) {
|
||||
dirty();
|
||||
intercept( target, name, Character.valueOf( oldValue ) );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double writeDouble(Object target, String name, double oldValue, double newValue) {
|
||||
dirty();
|
||||
intercept( target, name, Double.valueOf( oldValue ) );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float writeFloat(Object target, String name, float oldValue, float newValue) {
|
||||
dirty();
|
||||
intercept( target, name, Float.valueOf( oldValue ) );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int writeInt(Object target, String name, int oldValue, int newValue) {
|
||||
dirty();
|
||||
intercept( target, name, Integer.valueOf( oldValue ) );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long writeLong(Object target, String name, long oldValue, long newValue) {
|
||||
dirty();
|
||||
intercept( target, name, Long.valueOf( oldValue ) );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short writeShort(Object target, String name, short oldValue, short newValue) {
|
||||
dirty();
|
||||
intercept( target, name, Short.valueOf( oldValue ) );
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object writeObject(Object target, String name, Object oldValue, Object newValue) {
|
||||
dirty();
|
||||
intercept( target, name, oldValue );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FieldInterceptorImpl(entityName=" + getEntityName() +
|
||||
",dirty=" + isDirty() +
|
||||
|
|
|
@ -153,7 +153,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
final QueryKey key,
|
||||
final Type[] returnTypes,
|
||||
final boolean isNaturalKeyLookup,
|
||||
final Set spaces,
|
||||
final Set<Serializable> spaces,
|
||||
final SessionImplementor session) throws HibernateException {
|
||||
if ( DEBUGGING ) {
|
||||
LOG.debugf( "Checking cached query results in region: %s", cacheRegion.getName() );
|
||||
|
@ -223,7 +223,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
return result;
|
||||
}
|
||||
|
||||
protected boolean isUpToDate(final Set spaces, final Long timestamp) {
|
||||
protected boolean isUpToDate(final Set<Serializable> spaces, final Long timestamp) {
|
||||
if ( DEBUGGING ) {
|
||||
LOG.debugf( "Checking query spaces are up-to-date: %s", spaces );
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.cache.spi;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -75,7 +76,7 @@ public interface QueryCache {
|
|||
*
|
||||
* @throws HibernateException Indicates a problem delegating to the underlying cache.
|
||||
*/
|
||||
public List get(QueryKey key, Type[] returnTypes, boolean isNaturalKeyLookup, Set spaces, SessionImplementor session) throws HibernateException;
|
||||
public List get(QueryKey key, Type[] returnTypes, boolean isNaturalKeyLookup, Set<Serializable> spaces, SessionImplementor session) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Destroy the cache.
|
||||
|
|
|
@ -46,7 +46,7 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
*/
|
||||
public class UpdateTimestampsCache {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, UpdateTimestampsCache.class.getName() );
|
||||
|
||||
private static final boolean DEBUG_ENABLED = LOG.isDebugEnabled();
|
||||
/**
|
||||
* The region name of the update-timestamps cache.
|
||||
*/
|
||||
|
@ -90,15 +90,13 @@ public class UpdateTimestampsCache {
|
|||
*
|
||||
* @throws CacheException Indicated problem delegating to underlying region.
|
||||
*/
|
||||
@SuppressWarnings({"UnnecessaryBoxing"})
|
||||
public void preinvalidate(Serializable[] spaces) throws CacheException {
|
||||
final boolean debug = LOG.isDebugEnabled();
|
||||
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
||||
|
||||
final Long ts = region.nextTimestamp() + region.getTimeout();
|
||||
|
||||
for ( Serializable space : spaces ) {
|
||||
if ( debug ) {
|
||||
if ( DEBUG_ENABLED ) {
|
||||
LOG.debugf( "Pre-invalidating space [%s], timestamp: %s", space, ts );
|
||||
}
|
||||
//put() has nowait semantics, is this really appropriate?
|
||||
|
@ -117,15 +115,13 @@ public class UpdateTimestampsCache {
|
|||
*
|
||||
* @throws CacheException Indicated problem delegating to underlying region.
|
||||
*/
|
||||
@SuppressWarnings({"UnnecessaryBoxing"})
|
||||
public void invalidate(Serializable[] spaces) throws CacheException {
|
||||
final boolean debug = LOG.isDebugEnabled();
|
||||
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
||||
|
||||
final Long ts = region.nextTimestamp();
|
||||
|
||||
for (Serializable space : spaces) {
|
||||
if ( debug ) {
|
||||
if ( DEBUG_ENABLED ) {
|
||||
LOG.debugf( "Invalidating space [%s], timestamp: %s", space, ts );
|
||||
}
|
||||
//put() has nowait semantics, is this really appropriate?
|
||||
|
@ -147,12 +143,10 @@ public class UpdateTimestampsCache {
|
|||
*
|
||||
* @throws CacheException Indicated problem delegating to underlying region.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
||||
public boolean isUpToDate(Set spaces, Long timestamp) throws CacheException {
|
||||
final boolean debug = LOG.isDebugEnabled();
|
||||
public boolean isUpToDate(Set<Serializable> spaces, Long timestamp) throws CacheException {
|
||||
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
||||
|
||||
for ( Serializable space : (Set<Serializable>) spaces ) {
|
||||
for ( Serializable space : spaces ) {
|
||||
final Long lastUpdate = (Long) region.get( space );
|
||||
if ( lastUpdate == null ) {
|
||||
if ( stats ) {
|
||||
|
@ -164,7 +158,7 @@ public class UpdateTimestampsCache {
|
|||
//result = false; // safer
|
||||
}
|
||||
else {
|
||||
if ( debug ) {
|
||||
if ( DEBUG_ENABLED ) {
|
||||
LOG.debugf(
|
||||
"[%s] last update timestamp: %s",
|
||||
space,
|
||||
|
|
|
@ -50,10 +50,9 @@ public class StructuredCacheEntry implements CacheEntryStructure {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public Object destructure(Object structured, SessionFactoryImplementor factory) {
|
||||
final Map map = (Map) structured;
|
||||
final boolean lazyPropertiesUnfetched = ( (Boolean) map.get( "_lazyPropertiesUnfetched" ) ).booleanValue();
|
||||
final boolean lazyPropertiesUnfetched = (Boolean) map.get( "_lazyPropertiesUnfetched" );
|
||||
final String subclass = (String) map.get( "_subclass" );
|
||||
final Object version = map.get( "_version" );
|
||||
final EntityPersister subclassPersister = factory.getEntityPersister( subclass );
|
||||
|
|
|
@ -81,7 +81,6 @@ import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
|
|||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
||||
import org.hibernate.cache.spi.GeneralDataRegion;
|
||||
import org.hibernate.cfg.annotations.NamedEntityGraphDefinition;
|
||||
import org.hibernate.cfg.annotations.NamedProcedureCallDefinition;
|
||||
import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
|
||||
|
@ -876,12 +875,14 @@ public class Configuration implements Serializable {
|
|||
*/
|
||||
public Configuration addDirectory(File dir) throws MappingException {
|
||||
File[] files = dir.listFiles();
|
||||
for ( File file : files ) {
|
||||
if ( file.isDirectory() ) {
|
||||
addDirectory( file );
|
||||
}
|
||||
else if ( file.getName().endsWith( ".hbm.xml" ) ) {
|
||||
addFile( file );
|
||||
if ( files != null ) {
|
||||
for ( File file : files ) {
|
||||
if ( file.isDirectory() ) {
|
||||
addDirectory( file );
|
||||
}
|
||||
else if ( file.getName().endsWith( ".hbm.xml" ) ) {
|
||||
addFile( file );
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -1527,10 +1528,8 @@ public class Configuration implements Serializable {
|
|||
for ( FkSecondPass sp : dependencies ) {
|
||||
String dependentTable = quotedTableName(sp.getValue().getTable());
|
||||
if ( dependentTable.compareTo( startTable ) == 0 ) {
|
||||
StringBuilder sb = new StringBuilder(
|
||||
"Foreign key circularity dependency involving the following tables: "
|
||||
);
|
||||
throw new AnnotationException( sb.toString() );
|
||||
String sb = "Foreign key circularity dependency involving the following tables: ";
|
||||
throw new AnnotationException( sb );
|
||||
}
|
||||
buildRecursiveOrderedFkSecondPasses( orderedFkSecondPasses, isADependencyOf, startTable, dependentTable );
|
||||
if ( !orderedFkSecondPasses.contains( sp ) ) {
|
||||
|
@ -3151,7 +3150,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
return finalName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogicalColumnName(String physicalName, Table table) throws MappingException {
|
||||
String logical = null;
|
||||
Table currentTable = table;
|
||||
|
@ -3172,7 +3171,7 @@ public class Configuration implements Serializable {
|
|||
currentTable = null;
|
||||
}
|
||||
}
|
||||
while ( logical == null && currentTable != null && description != null );
|
||||
while ( logical == null && currentTable != null );
|
||||
if ( logical == null ) {
|
||||
throw new MappingException(
|
||||
"Unable to find logical column name from physical name "
|
||||
|
@ -3294,41 +3293,38 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
private Boolean useNewGeneratorMappings;
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public boolean useNewGeneratorMappings() {
|
||||
if ( useNewGeneratorMappings == null ) {
|
||||
final String booleanName = getConfigurationProperties()
|
||||
.getProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS );
|
||||
useNewGeneratorMappings = Boolean.valueOf( booleanName );
|
||||
}
|
||||
return useNewGeneratorMappings.booleanValue();
|
||||
return useNewGeneratorMappings;
|
||||
}
|
||||
|
||||
private Boolean useNationalizedCharacterData;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public boolean useNationalizedCharacterData() {
|
||||
if ( useNationalizedCharacterData == null ) {
|
||||
final String booleanName = getConfigurationProperties()
|
||||
.getProperty( AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA );
|
||||
useNationalizedCharacterData = Boolean.valueOf( booleanName );
|
||||
}
|
||||
return useNationalizedCharacterData.booleanValue();
|
||||
return useNationalizedCharacterData;
|
||||
}
|
||||
|
||||
private Boolean forceDiscriminatorInSelectsByDefault;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public boolean forceDiscriminatorInSelectsByDefault() {
|
||||
if ( forceDiscriminatorInSelectsByDefault == null ) {
|
||||
final String booleanName = getConfigurationProperties()
|
||||
.getProperty( AvailableSettings.FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT );
|
||||
forceDiscriminatorInSelectsByDefault = Boolean.valueOf( booleanName );
|
||||
}
|
||||
return forceDiscriminatorInSelectsByDefault.booleanValue();
|
||||
return forceDiscriminatorInSelectsByDefault;
|
||||
}
|
||||
|
||||
public IdGenerator getGenerator(String name) {
|
||||
|
@ -3520,7 +3516,7 @@ public class Configuration implements Serializable {
|
|||
//Do not cache this value as we lazily set it in Hibernate Annotation (AnnotationConfiguration)
|
||||
//TODO use a dedicated protected useQuotedIdentifier flag in Configuration (overriden by AnnotationConfiguration)
|
||||
String setting = (String) properties.get( Environment.GLOBALLY_QUOTED_IDENTIFIERS );
|
||||
return setting != null && Boolean.valueOf( setting ).booleanValue();
|
||||
return setting != null && Boolean.valueOf( setting );
|
||||
}
|
||||
|
||||
public NamingStrategy getNamingStrategy() {
|
||||
|
|
|
@ -284,10 +284,9 @@ public class PersistentBag extends AbstractPersistentCollection implements List
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public boolean contains(Object object) {
|
||||
final Boolean exists = readElementExistence( object );
|
||||
return exists == null ? bag.contains( object ) : exists.booleanValue();
|
||||
return exists == null ? bag.contains( object ) : exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -136,12 +136,11 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public boolean contains(Object object) {
|
||||
final Boolean exists = readElementExistence( object );
|
||||
return exists == null
|
||||
? list.contains( object )
|
||||
: exists.booleanValue();
|
||||
: exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,7 +175,6 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public boolean remove(Object value) {
|
||||
final Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
|
||||
if ( exists == null ) {
|
||||
|
@ -189,7 +187,7 @@ public class PersistentList extends AbstractPersistentCollection implements List
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if ( exists.booleanValue() ) {
|
||||
else if ( exists ) {
|
||||
queueOperation( new SimpleRemove( value ) );
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -146,19 +146,17 @@ public class PersistentMap extends AbstractPersistentCollection implements Map {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public boolean containsKey(Object key) {
|
||||
final Boolean exists = readIndexExistence( key );
|
||||
return exists == null ? map.containsKey( key ) : exists.booleanValue();
|
||||
return exists == null ? map.containsKey( key ) : exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public boolean containsValue(Object value) {
|
||||
final Boolean exists = readElementExistence( value );
|
||||
return exists == null
|
||||
? map.containsValue( value )
|
||||
: exists.booleanValue();
|
||||
: exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -167,12 +167,11 @@ public class PersistentSet extends AbstractPersistentCollection implements java.
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
||||
public boolean contains(Object object) {
|
||||
final Boolean exists = readElementExistence( object );
|
||||
return exists == null
|
||||
? set.contains( object )
|
||||
: exists.booleanValue();
|
||||
: exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -197,7 +196,6 @@ public class PersistentSet extends AbstractPersistentCollection implements java.
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
||||
public boolean add(Object value) {
|
||||
final Boolean exists = isOperationQueueEnabled() ? readElementExistence( value ) : null;
|
||||
if ( exists == null ) {
|
||||
|
@ -210,7 +208,7 @@ public class PersistentSet extends AbstractPersistentCollection implements java.
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if ( exists.booleanValue() ) {
|
||||
else if ( exists ) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
@ -220,7 +218,6 @@ public class PersistentSet extends AbstractPersistentCollection implements java.
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
||||
public boolean remove(Object value) {
|
||||
final Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
|
||||
if ( exists == null ) {
|
||||
|
@ -233,7 +230,7 @@ public class PersistentSet extends AbstractPersistentCollection implements java.
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if ( exists.booleanValue() ) {
|
||||
else if ( exists ) {
|
||||
queueOperation( new SimpleRemove( value ) );
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -77,15 +77,14 @@ public class DerbyDialect extends DB2Dialect {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UnnecessaryUnboxing", "unchecked"})
|
||||
private void determineDriverVersion() {
|
||||
try {
|
||||
// locate the derby sysinfo class and query its version info
|
||||
final Class sysinfoClass = ReflectHelper.classForName( "org.apache.derby.tools.sysinfo", this.getClass() );
|
||||
final Method majorVersionGetter = sysinfoClass.getMethod( "getMajorVersion", ReflectHelper.NO_PARAM_SIGNATURE );
|
||||
final Method minorVersionGetter = sysinfoClass.getMethod( "getMinorVersion", ReflectHelper.NO_PARAM_SIGNATURE );
|
||||
driverVersionMajor = ( (Integer) majorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS ) ).intValue();
|
||||
driverVersionMinor = ( (Integer) minorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS ) ).intValue();
|
||||
driverVersionMajor = (Integer) majorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS );
|
||||
driverVersionMinor = (Integer) minorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
LOG.unableToLoadDerbyDriver( e.getMessage() );
|
||||
|
|
|
@ -50,7 +50,6 @@ public class TemplateRenderer {
|
|||
*
|
||||
* @param template The template
|
||||
*/
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
public TemplateRenderer(String template) {
|
||||
this.template = template;
|
||||
|
||||
|
|
|
@ -225,7 +225,6 @@ public final class ForeignKeys {
|
|||
*
|
||||
* @return {@code true} if the given entity is transient (unsaved)
|
||||
*/
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public static boolean isTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session) {
|
||||
if ( entity == LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
|
||||
// an unfetched association can only point to
|
||||
|
@ -236,20 +235,20 @@ public final class ForeignKeys {
|
|||
// let the interceptor inspect the instance to decide
|
||||
Boolean isUnsaved = session.getInterceptor().isTransient( entity );
|
||||
if ( isUnsaved != null ) {
|
||||
return isUnsaved.booleanValue();
|
||||
return isUnsaved;
|
||||
}
|
||||
|
||||
// let the persister inspect the instance to decide
|
||||
final EntityPersister persister = session.getEntityPersister( entityName, entity );
|
||||
isUnsaved = persister.isTransient( entity, session );
|
||||
if ( isUnsaved != null ) {
|
||||
return isUnsaved.booleanValue();
|
||||
return isUnsaved;
|
||||
}
|
||||
|
||||
// we use the assumed value, if there is one, to avoid hitting
|
||||
// the database
|
||||
if ( assumed != null ) {
|
||||
return assumed.booleanValue();
|
||||
return assumed;
|
||||
}
|
||||
|
||||
// hit the database, after checking the session cache for a snapshot
|
||||
|
|
|
@ -104,13 +104,12 @@ public class BlobProxy implements InvocationHandler {
|
|||
* or toString/equals/hashCode are invoked.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
final String methodName = method.getName();
|
||||
final int argCount = method.getParameterTypes().length;
|
||||
|
||||
if ( "length".equals( methodName ) && argCount == 0 ) {
|
||||
return Long.valueOf( getLength() );
|
||||
return getLength();
|
||||
}
|
||||
if ( "getUnderlyingStream".equals( methodName ) ) {
|
||||
return getUnderlyingStream(); // Reset stream if needed.
|
||||
|
@ -157,7 +156,7 @@ public class BlobProxy implements InvocationHandler {
|
|||
return this.toString();
|
||||
}
|
||||
if ( "equals".equals( methodName ) && argCount == 1 ) {
|
||||
return Boolean.valueOf( proxy == args[0] );
|
||||
return proxy == args[0];
|
||||
}
|
||||
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
||||
return this.hashCode();
|
||||
|
|
|
@ -104,13 +104,12 @@ public class ClobProxy implements InvocationHandler {
|
|||
* {@link Clob#free}, or toString/equals/hashCode are invoked.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
final String methodName = method.getName();
|
||||
final int argCount = method.getParameterTypes().length;
|
||||
|
||||
if ( "length".equals( methodName ) && argCount == 0 ) {
|
||||
return Long.valueOf( getLength() );
|
||||
return getLength();
|
||||
}
|
||||
if ( "getUnderlyingStream".equals( methodName ) ) {
|
||||
return getUnderlyingStream(); // Reset stream if needed.
|
||||
|
@ -161,7 +160,7 @@ public class ClobProxy implements InvocationHandler {
|
|||
return this.toString();
|
||||
}
|
||||
if ( "equals".equals( methodName ) && argCount == 1 ) {
|
||||
return Boolean.valueOf( proxy == args[0] );
|
||||
return proxy == args[0];
|
||||
}
|
||||
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
||||
return this.hashCode();
|
||||
|
|
|
@ -89,10 +89,9 @@ public class ResultSetWrapperProxy implements InvocationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if ( "findColumn".equals( method.getName() ) ) {
|
||||
return Integer.valueOf( findColumn( (String) args[0] ) );
|
||||
return findColumn( (String) args[0] );
|
||||
}
|
||||
|
||||
if ( isFirstArgColumnLabel( method, args ) ) {
|
||||
|
@ -168,10 +167,9 @@ public class ResultSetWrapperProxy implements InvocationHandler {
|
|||
return columnNameMethod.getDeclaringClass().getMethod( columnNameMethod.getName(), actualParameterTypes );
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
private Object[] buildColumnIndexMethodArgs(Object[] incomingArgs, int columnIndex) {
|
||||
final Object[] actualArgs = new Object[incomingArgs.length];
|
||||
actualArgs[0] = Integer.valueOf( columnIndex );
|
||||
actualArgs[0] = columnIndex;
|
||||
System.arraycopy( incomingArgs, 1, actualArgs, 1, incomingArgs.length - 1 );
|
||||
return actualArgs;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ import org.jboss.logging.Logger;
|
|||
* @author Gavin King
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public class DriverManagerConnectionProviderImpl
|
||||
implements ConnectionProvider, Configurable, Stoppable, ServiceRegistryAwareService {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, DriverManagerConnectionProviderImpl.class.getName() );
|
||||
|
@ -141,7 +140,7 @@ public class DriverManagerConnectionProviderImpl
|
|||
|
||||
isolation = ConfigurationHelper.getInteger( AvailableSettings.ISOLATION, configurationValues );
|
||||
if ( isolation != null ) {
|
||||
LOG.jdbcIsolationLevel( Environment.isolationLevelToString( isolation.intValue() ) );
|
||||
LOG.jdbcIsolationLevel( Environment.isolationLevelToString( isolation ) );
|
||||
}
|
||||
|
||||
url = (String) configurationValues.get( AvailableSettings.URL );
|
||||
|
@ -195,7 +194,7 @@ public class DriverManagerConnectionProviderImpl
|
|||
}
|
||||
final Connection pooled = pool.remove( last );
|
||||
if ( isolation != null ) {
|
||||
pooled.setTransactionIsolation( isolation.intValue() );
|
||||
pooled.setTransactionIsolation( isolation );
|
||||
}
|
||||
if ( pooled.getAutoCommit() != autocommit ) {
|
||||
pooled.setAutoCommit( autocommit );
|
||||
|
@ -225,7 +224,7 @@ public class DriverManagerConnectionProviderImpl
|
|||
}
|
||||
|
||||
if ( isolation != null ) {
|
||||
conn.setTransactionIsolation( isolation.intValue() );
|
||||
conn.setTransactionIsolation( isolation );
|
||||
}
|
||||
if ( conn.getAutoCommit() != autocommit ) {
|
||||
conn.setAutoCommit( autocommit );
|
||||
|
|
|
@ -174,12 +174,11 @@ public class StandardRefCursorSupport implements RefCursorSupport {
|
|||
*
|
||||
* @return {@code true} if the metadata indicates that the driver defines REF_CURSOR support
|
||||
*/
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public static boolean supportsRefCursors(DatabaseMetaData meta) {
|
||||
// Standard JDBC REF_CURSOR support was not added until Java 8, so we need to use reflection to attempt to
|
||||
// access these fields/methods...
|
||||
try {
|
||||
return ( (Boolean) meta.getClass().getMethod( "supportsRefCursors" ).invoke( null ) ).booleanValue();
|
||||
return (Boolean) meta.getClass().getMethod( "supportsRefCursors" ).invoke( null );
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
log.trace( "JDBC DatabaseMetaData class does not define supportsRefCursors method..." );
|
||||
|
@ -193,7 +192,6 @@ public class StandardRefCursorSupport implements RefCursorSupport {
|
|||
|
||||
private static Integer refCursorTypeCode;
|
||||
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
private int refCursorTypeCode() {
|
||||
if ( refCursorTypeCode == null ) {
|
||||
try {
|
||||
|
|
|
@ -274,13 +274,12 @@ public class BasicFormatterImpl implements Formatter {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
private void select() {
|
||||
out();
|
||||
indent++;
|
||||
newline();
|
||||
parenCounts.addLast( Integer.valueOf( parensSinceSelect ) );
|
||||
afterByOrFromOrSelects.addLast( Boolean.valueOf( afterByOrSetOrFromOrSelect ) );
|
||||
parenCounts.addLast( parensSinceSelect );
|
||||
afterByOrFromOrSelects.addLast( afterByOrSetOrFromOrSelect );
|
||||
parensSinceSelect = 0;
|
||||
afterByOrSetOrFromOrSelect = true;
|
||||
}
|
||||
|
@ -332,13 +331,12 @@ public class BasicFormatterImpl implements Formatter {
|
|||
afterValues = true;
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
private void closeParen() {
|
||||
parensSinceSelect--;
|
||||
if ( parensSinceSelect < 0 ) {
|
||||
indent--;
|
||||
parensSinceSelect = parenCounts.removeLast();
|
||||
afterByOrSetOrFromOrSelect = afterByOrFromOrSelects.removeLast().booleanValue();
|
||||
afterByOrSetOrFromOrSelect = afterByOrFromOrSelects.removeLast();
|
||||
}
|
||||
if ( inFunction > 0 ) {
|
||||
inFunction--;
|
||||
|
|
|
@ -106,7 +106,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
this.translators = new QueryTranslator[length];
|
||||
|
||||
final List<String> sqlStringList = new ArrayList<String>();
|
||||
final Set combinedQuerySpaces = new HashSet();
|
||||
final Set<Serializable> combinedQuerySpaces = new HashSet<Serializable>();
|
||||
|
||||
final boolean hasCollectionRole = (collectionRole == null);
|
||||
final Map querySubstitutions = factory.getSettings().getQuerySubstitutions();
|
||||
|
|
|
@ -129,7 +129,7 @@ public class ParameterMetadata implements Serializable {
|
|||
*
|
||||
* @return The named parameter names
|
||||
*/
|
||||
public Set getNamedParameterNames() {
|
||||
public Set<String> getNamedParameterNames() {
|
||||
return namedDescriptorMap.keySet();
|
||||
}
|
||||
|
||||
|
|
|
@ -321,7 +321,6 @@ public class QueryPlanCache implements Serializable {
|
|||
private final Map<String,Integer> parameterMetadata;
|
||||
private final int hashCode;
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
private DynamicFilterKey(FilterImpl filter) {
|
||||
this.filterName = filter.getName();
|
||||
if ( filter.getParameters().isEmpty() ) {
|
||||
|
|
|
@ -782,7 +782,6 @@ public class ActionQueue {
|
|||
/**
|
||||
* Sort the insert actions.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "UnnecessaryBoxing" })
|
||||
public void sort() {
|
||||
// the list of entity names that indicate the batch number
|
||||
for ( EntityInsertAction action : (List<EntityInsertAction>) insertions ) {
|
||||
|
@ -831,7 +830,6 @@ public class ActionQueue {
|
|||
*
|
||||
* @return An appropriate batch number; todo document this process better
|
||||
*/
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "unchecked" })
|
||||
private Integer findBatchNumber(
|
||||
EntityInsertAction action,
|
||||
String entityName) {
|
||||
|
|
|
@ -74,10 +74,9 @@ public class WebSphereExtendedJtaPlatform extends AbstractJtaPlatform {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public Object getTransactionIdentifier(Transaction transaction) {
|
||||
// WebSphere, however, is not a sane JEE/JTA container...
|
||||
return Integer.valueOf( transaction.hashCode() );
|
||||
return transaction.hashCode();
|
||||
}
|
||||
|
||||
public class TransactionManagerAdapter implements TransactionManager {
|
||||
|
|
|
@ -139,7 +139,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par
|
|||
**/
|
||||
private Map<String, SelectExpression> selectExpressionsByResultVariable = new HashMap<String, SelectExpression>();
|
||||
|
||||
private Set querySpaces = new HashSet();
|
||||
private Set<Serializable> querySpaces = new HashSet<Serializable>();
|
||||
|
||||
private int parameterCount;
|
||||
private Map namedParameters = new HashMap();
|
||||
|
@ -315,7 +315,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par
|
|||
*
|
||||
* @return A set of table names (Strings).
|
||||
*/
|
||||
public Set getQuerySpaces() {
|
||||
public Set<Serializable> getQuerySpaces() {
|
||||
return querySpaces;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.hql.internal.ast;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -342,7 +343,7 @@ public class QueryTranslatorImpl implements FilterTranslator {
|
|||
return getWalker().getSelectClause().getColumnNames();
|
||||
}
|
||||
@Override
|
||||
public Set getQuerySpaces() {
|
||||
public Set<Serializable> getQuerySpaces() {
|
||||
return getWalker().getQuerySpaces();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -107,7 +108,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
private final Map joins = new LinkedHashMap();
|
||||
private final List orderByTokens = new ArrayList();
|
||||
private final List groupByTokens = new ArrayList();
|
||||
private final Set querySpaces = new HashSet();
|
||||
private final Set<Serializable> querySpaces = new HashSet<Serializable>();
|
||||
private final Set entitiesToFetch = new HashSet();
|
||||
|
||||
private final Map pathAliases = new HashMap();
|
||||
|
@ -821,7 +822,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
|
||||
}
|
||||
|
||||
public final Set getQuerySpaces() {
|
||||
public final Set<Serializable> getQuerySpaces() {
|
||||
return querySpaces;
|
||||
}
|
||||
|
||||
|
@ -835,9 +836,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
}
|
||||
|
||||
void addQuerySpaces(Serializable[] spaces) {
|
||||
for ( int i = 0; i < spaces.length; i++ ) {
|
||||
querySpaces.add( spaces[i] );
|
||||
}
|
||||
Collections.addAll( querySpaces, spaces );
|
||||
if ( superQuery != null ) superQuery.addQuerySpaces( spaces );
|
||||
}
|
||||
|
||||
|
@ -936,6 +935,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
pathJoins.put( path, joinSequence );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List list(SessionImplementor session, QueryParameters queryParameters)
|
||||
throws HibernateException {
|
||||
return list( session, queryParameters, getQuerySpaces(), actualReturnTypes );
|
||||
|
@ -944,6 +944,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
/**
|
||||
* Return the query results as an iterator
|
||||
*/
|
||||
@Override
|
||||
public Iterator iterate(QueryParameters queryParameters, EventSource session)
|
||||
throws HibernateException {
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.hql.spi;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -110,7 +111,7 @@ public interface QueryTranslator {
|
|||
*
|
||||
* @return A set of query spaces (table names).
|
||||
*/
|
||||
Set getQuerySpaces();
|
||||
Set<Serializable> getQuerySpaces();
|
||||
|
||||
/**
|
||||
* Retrieve the query identifier for this translator. The query identifier is
|
||||
|
|
|
@ -162,16 +162,14 @@ public class TemporaryTableBulkIdStrategy implements MultiTableBulkIdStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
protected boolean shouldIsolateTemporaryTableDDL(SessionImplementor session) {
|
||||
Boolean dialectVote = session.getFactory().getDialect().performTemporaryTableDDLInIsolation();
|
||||
if ( dialectVote != null ) {
|
||||
return dialectVote.booleanValue();
|
||||
return dialectVote;
|
||||
}
|
||||
return session.getFactory().getSettings().isDataDefinitionImplicitCommit();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
protected boolean shouldTransactIsolatedTemporaryTableDDL(SessionImplementor session) {
|
||||
// is there ever a time when it makes sense to do this?
|
||||
// return session.getFactory().getSettings().isDataDefinitionInTransactionSupported();
|
||||
|
|
|
@ -67,7 +67,6 @@ public class OptimizerFactory {
|
|||
* @deprecated Use {@link #buildOptimizer(String, Class, int, long)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
||||
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize) {
|
||||
final Class<? extends Optimizer> optimizerClass;
|
||||
|
||||
|
@ -87,7 +86,7 @@ public class OptimizerFactory {
|
|||
|
||||
try {
|
||||
final Constructor ctor = optimizerClass.getConstructor( CTOR_SIG );
|
||||
return (Optimizer) ctor.newInstance( returnClass, Integer.valueOf( incrementSize ) );
|
||||
return (Optimizer) ctor.newInstance( returnClass, incrementSize );
|
||||
}
|
||||
catch( Throwable ignore ) {
|
||||
LOG.unableToInstantiateOptimizer( type );
|
||||
|
@ -110,7 +109,6 @@ public class OptimizerFactory {
|
|||
*
|
||||
* @return The built optimizer
|
||||
*/
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "deprecation" })
|
||||
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize, long explicitInitialValue) {
|
||||
final Optimizer optimizer = buildOptimizer( type, returnClass, incrementSize );
|
||||
if ( InitialValueAwareOptimizer.class.isInstance( optimizer ) ) {
|
||||
|
|
|
@ -91,7 +91,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
private List values = new ArrayList(4);
|
||||
private List types = new ArrayList(4);
|
||||
private Map<String,TypedValue> namedParameters = new HashMap<String, TypedValue>(4);
|
||||
private Map namedParameterLists = new HashMap(4);
|
||||
private Map<String, TypedValue> namedParameterLists = new HashMap<String, TypedValue>(4);
|
||||
|
||||
private Object optionalObject;
|
||||
private Serializable optionalId;
|
||||
|
@ -256,24 +256,20 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isReadOnly() {
|
||||
return ( readOnly == null ?
|
||||
getSession().getPersistenceContext().isDefaultReadOnly() :
|
||||
readOnly.booleanValue()
|
||||
readOnly
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Query setReadOnly(boolean readOnly) {
|
||||
this.readOnly = Boolean.valueOf( readOnly );
|
||||
this.readOnly = readOnly;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query setResultTransformer(ResultTransformer transformer) {
|
||||
this.resultTransformer = transformer;
|
||||
return this;
|
||||
|
@ -294,7 +290,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
SessionImplementor getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract LockOptions getLockOptions();
|
||||
|
||||
|
||||
|
@ -305,8 +301,8 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
*
|
||||
* @return Shallow copy of the named parameter value map
|
||||
*/
|
||||
protected Map getNamedParams() {
|
||||
return new HashMap( namedParameters );
|
||||
protected Map<String, TypedValue> getNamedParams() {
|
||||
return new HashMap<String, TypedValue>( namedParameters );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -323,6 +319,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
* @return Array of named parameter names.
|
||||
* @throws HibernateException
|
||||
*/
|
||||
@Override
|
||||
public String[] getNamedParameters() throws HibernateException {
|
||||
return ArrayHelper.toStringArray( parameterMetadata.getNamedParameterNames() );
|
||||
}
|
||||
|
@ -343,7 +340,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
*
|
||||
* @return The parameter list value map.
|
||||
*/
|
||||
protected Map getNamedParameterLists() {
|
||||
protected Map<String, TypedValue> getNamedParameterLists() {
|
||||
return namedParameterLists;
|
||||
}
|
||||
|
||||
|
@ -387,7 +384,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
*/
|
||||
protected void verifyParameters(boolean reserveFirstParameter) throws HibernateException {
|
||||
if ( parameterMetadata.getNamedParameterNames().size() != namedParameters.size() + namedParameterLists.size() ) {
|
||||
Set missingParams = new HashSet( parameterMetadata.getNamedParameterNames() );
|
||||
Set<String> missingParams = new HashSet<String>( parameterMetadata.getNamedParameterNames() );
|
||||
missingParams.removeAll( namedParameterLists.keySet() );
|
||||
missingParams.removeAll( namedParameters.keySet() );
|
||||
throw new QueryException( "Not all named parameters have been set: " + missingParams, getQueryString() );
|
||||
|
@ -776,6 +773,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query setParameterList(String name, Collection vals, Type type) throws HibernateException {
|
||||
if ( !parameterMetadata.getNamedParameterNames().contains( name ) ) {
|
||||
throw new IllegalArgumentException("Parameter " + name + " does not exist as a named parameter in [" + getQueryString() + "]");
|
||||
|
@ -790,9 +788,8 @@ public abstract class AbstractQueryImpl implements Query {
|
|||
*/
|
||||
protected String expandParameterLists(Map namedParamsCopy) {
|
||||
String query = this.queryString;
|
||||
Iterator iter = namedParameterLists.entrySet().iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Map.Entry me = (Map.Entry) iter.next();
|
||||
for ( Map.Entry<String, TypedValue> stringTypedValueEntry : namedParameterLists.entrySet() ) {
|
||||
Map.Entry me = (Map.Entry) stringTypedValueEntry;
|
||||
query = expandParameterList( query, (String) me.getKey(), (TypedValue) me.getValue(), namedParamsCopy );
|
||||
}
|
||||
return query;
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.io.Serializable;
|
|||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -187,7 +186,6 @@ public abstract class AbstractSessionImpl
|
|||
return query;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
private void initQuery(Query query, NamedQueryDefinition nqd) {
|
||||
// todo : cacheable and readonly should be Boolean rather than boolean...
|
||||
query.setCacheable( nqd.isCacheable() );
|
||||
|
|
|
@ -2325,7 +2325,7 @@ public abstract class Loader {
|
|||
protected List list(
|
||||
final SessionImplementor session,
|
||||
final QueryParameters queryParameters,
|
||||
final Set querySpaces,
|
||||
final Set<Serializable> querySpaces,
|
||||
final Type[] resultTypes) throws HibernateException {
|
||||
|
||||
final boolean cacheable = factory.getSettings().isQueryCacheEnabled() &&
|
||||
|
@ -2346,7 +2346,7 @@ public abstract class Loader {
|
|||
private List listUsingQueryCache(
|
||||
final SessionImplementor session,
|
||||
final QueryParameters queryParameters,
|
||||
final Set querySpaces,
|
||||
final Set<Serializable> querySpaces,
|
||||
final Type[] resultTypes) {
|
||||
|
||||
QueryCache queryCache = factory.getQueryCache( queryParameters.getCacheRegion() );
|
||||
|
@ -2423,7 +2423,7 @@ public abstract class Loader {
|
|||
private List getResultFromQueryCache(
|
||||
final SessionImplementor session,
|
||||
final QueryParameters queryParameters,
|
||||
final Set querySpaces,
|
||||
final Set<Serializable> querySpaces,
|
||||
final Type[] resultTypes,
|
||||
final QueryCache queryCache,
|
||||
final QueryKey key) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
*/
|
||||
package org.hibernate.loader.criteria;
|
||||
import java.io.Serializable;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
@ -68,7 +69,7 @@ public class CriteriaLoader extends OuterJoinLoader {
|
|||
// multithreaded, or cacheable!!
|
||||
|
||||
private final CriteriaQueryTranslator translator;
|
||||
private final Set querySpaces;
|
||||
private final Set<Serializable> querySpaces;
|
||||
private final Type[] resultTypes;
|
||||
//the user visible aliases, which are unknown to the superclass,
|
||||
//these are not the actual "physical" SQL aliases
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.loader.custom;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
@ -71,7 +72,7 @@ public class CustomLoader extends Loader {
|
|||
// Currently *not* cachable if autodiscover types is in effect (e.g. "select * ...")
|
||||
|
||||
private final String sql;
|
||||
private final Set querySpaces = new HashSet();
|
||||
private final Set<Serializable> querySpaces = new HashSet<Serializable>();
|
||||
private final Map namedParameterBindPoints;
|
||||
|
||||
private final Queryable[] entityPersisters;
|
||||
|
|
|
@ -771,7 +771,7 @@ public abstract class AbstractEntityPersister
|
|||
iter = definedBySubclass.iterator();
|
||||
j = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
propertyDefinedOnSubclass[j++] = ( ( Boolean ) iter.next() ).booleanValue();
|
||||
propertyDefinedOnSubclass[j++] = (Boolean) iter.next();
|
||||
}
|
||||
|
||||
// Handle any filters applied to the class level
|
||||
|
@ -4875,12 +4875,11 @@ public abstract class AbstractEntityPersister
|
|||
return generateEntityIdByNaturalIdSql( valueNullness );
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
protected boolean isNaturalIdNonNullable() {
|
||||
if ( naturalIdIsNonNullable == null ) {
|
||||
naturalIdIsNonNullable = determineNaturalIdNullability();
|
||||
}
|
||||
return naturalIdIsNonNullable.booleanValue();
|
||||
return naturalIdIsNonNullable;
|
||||
}
|
||||
|
||||
private boolean determineNaturalIdNullability() {
|
||||
|
|
|
@ -132,7 +132,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
|||
}
|
||||
else {
|
||||
// use the read-only/modifiable setting indicated during deserialization
|
||||
setReadOnly( readOnlyBeforeAttachedToSession.booleanValue() );
|
||||
setReadOnly( readOnlyBeforeAttachedToSession );
|
||||
readOnlyBeforeAttachedToSession = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
|
||||
protected abstract Object serializableProxy();
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
protected final Object invoke(Method method, Object[] args, Object proxy) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
int params = args.length;
|
||||
|
@ -78,7 +77,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
return getReplacement();
|
||||
}
|
||||
else if ( !overridesEquals && "hashCode".equals(methodName) ) {
|
||||
return Integer.valueOf( System.identityHashCode(proxy) );
|
||||
return System.identityHashCode(proxy);
|
||||
}
|
||||
else if ( isUninitialized() && method.equals(getIdentifierMethod) ) {
|
||||
return getIdentifier();
|
||||
|
|
|
@ -406,9 +406,9 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public void queryExecuted(String hql, int rows, long time) {
|
||||
LOG.hql(hql, Long.valueOf(time), Long.valueOf(rows));
|
||||
LOG.hql(hql, time, (long) rows );
|
||||
queryExecutionCount.getAndIncrement();
|
||||
boolean isLongestQuery = false;
|
||||
for ( long old = queryExecutionMaxTime.get();
|
||||
|
@ -424,7 +424,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
qs.executed( rows, time );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryCacheHit(String hql, String regionName) {
|
||||
queryCacheHitCount.getAndIncrement();
|
||||
if ( hql != null ) {
|
||||
|
@ -436,7 +436,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
);
|
||||
slcs.incrementHitCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryCacheMiss(String hql, String regionName) {
|
||||
queryCacheMissCount.getAndIncrement();
|
||||
if ( hql != null ) {
|
||||
|
@ -448,7 +448,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
);
|
||||
slcs.incrementMissCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryCachePut(String hql, String regionName) {
|
||||
queryCachePutCount.getAndIncrement();
|
||||
if ( hql != null ) {
|
||||
|
@ -483,6 +483,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
*
|
||||
* @return QueryStatistics
|
||||
*/
|
||||
@Override
|
||||
public QueryStatistics getQueryStatistics(String queryString) {
|
||||
ConcurrentQueryStatisticsImpl qs = (ConcurrentQueryStatisticsImpl) queryStatistics.get( queryString );
|
||||
if ( qs == null ) {
|
||||
|
@ -500,6 +501,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return entity deletion count
|
||||
*/
|
||||
@Override
|
||||
public long getEntityDeleteCount() {
|
||||
return entityDeleteCount.get();
|
||||
}
|
||||
|
@ -507,6 +509,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return entity insertion count
|
||||
*/
|
||||
@Override
|
||||
public long getEntityInsertCount() {
|
||||
return entityInsertCount.get();
|
||||
}
|
||||
|
@ -514,6 +517,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return entity load (from DB)
|
||||
*/
|
||||
@Override
|
||||
public long getEntityLoadCount() {
|
||||
return entityLoadCount.get();
|
||||
}
|
||||
|
@ -521,6 +525,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return entity fetch (from DB)
|
||||
*/
|
||||
@Override
|
||||
public long getEntityFetchCount() {
|
||||
return entityFetchCount.get();
|
||||
}
|
||||
|
@ -528,34 +533,35 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return entity update
|
||||
*/
|
||||
@Override
|
||||
public long getEntityUpdateCount() {
|
||||
return entityUpdateCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getQueryExecutionCount() {
|
||||
return queryExecutionCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getQueryCacheHitCount() {
|
||||
return queryCacheHitCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getQueryCacheMissCount() {
|
||||
return queryCacheMissCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getQueryCachePutCount() {
|
||||
return queryCachePutCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUpdateTimestampsCacheHitCount() {
|
||||
return updateTimestampsCacheHitCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUpdateTimestampsCacheMissCount() {
|
||||
return updateTimestampsCacheMissCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUpdateTimestampsCachePutCount() {
|
||||
return updateTimestampsCachePutCount.get();
|
||||
}
|
||||
|
@ -563,6 +569,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return flush
|
||||
*/
|
||||
@Override
|
||||
public long getFlushCount() {
|
||||
return flushCount.get();
|
||||
}
|
||||
|
@ -570,6 +577,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return session connect
|
||||
*/
|
||||
@Override
|
||||
public long getConnectCount() {
|
||||
return connectCount.get();
|
||||
}
|
||||
|
@ -577,6 +585,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return second level cache hit
|
||||
*/
|
||||
@Override
|
||||
public long getSecondLevelCacheHitCount() {
|
||||
return secondLevelCacheHitCount.get();
|
||||
}
|
||||
|
@ -584,6 +593,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return second level cache miss
|
||||
*/
|
||||
@Override
|
||||
public long getSecondLevelCacheMissCount() {
|
||||
return secondLevelCacheMissCount.get();
|
||||
}
|
||||
|
@ -591,6 +601,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return second level cache put
|
||||
*/
|
||||
@Override
|
||||
public long getSecondLevelCachePutCount() {
|
||||
return secondLevelCachePutCount.get();
|
||||
}
|
||||
|
@ -628,6 +639,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return session closing
|
||||
*/
|
||||
@Override
|
||||
public long getSessionCloseCount() {
|
||||
return sessionCloseCount.get();
|
||||
}
|
||||
|
@ -635,6 +647,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return session opening
|
||||
*/
|
||||
@Override
|
||||
public long getSessionOpenCount() {
|
||||
return sessionOpenCount.get();
|
||||
}
|
||||
|
@ -642,6 +655,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return collection loading (from DB)
|
||||
*/
|
||||
@Override
|
||||
public long getCollectionLoadCount() {
|
||||
return collectionLoadCount.get();
|
||||
}
|
||||
|
@ -649,6 +663,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return collection fetching (from DB)
|
||||
*/
|
||||
@Override
|
||||
public long getCollectionFetchCount() {
|
||||
return collectionFetchCount.get();
|
||||
}
|
||||
|
@ -656,6 +671,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return collection update
|
||||
*/
|
||||
@Override
|
||||
public long getCollectionUpdateCount() {
|
||||
return collectionUpdateCount.get();
|
||||
}
|
||||
|
@ -664,6 +680,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
* @return collection removal
|
||||
* FIXME: even if isInverse="true"?
|
||||
*/
|
||||
@Override
|
||||
public long getCollectionRemoveCount() {
|
||||
return collectionRemoveCount.get();
|
||||
}
|
||||
|
@ -671,6 +688,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return collection recreation
|
||||
*/
|
||||
@Override
|
||||
public long getCollectionRecreateCount() {
|
||||
return collectionRecreateCount.get();
|
||||
}
|
||||
|
@ -678,6 +696,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* @return start time in ms (JVM standards {@link System#currentTimeMillis()})
|
||||
*/
|
||||
@Override
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
@ -685,6 +704,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* log in info level the main statistics
|
||||
*/
|
||||
@Override
|
||||
public void logSummary() {
|
||||
LOG.loggingStatistics();
|
||||
LOG.startTime( startTime );
|
||||
|
@ -728,6 +748,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* Are statistics logged
|
||||
*/
|
||||
@Override
|
||||
public boolean isStatisticsEnabled() {
|
||||
return isStatisticsEnabled;
|
||||
}
|
||||
|
@ -735,6 +756,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* Enable statistics logs (this is a dynamic parameter)
|
||||
*/
|
||||
@Override
|
||||
public void setStatisticsEnabled(boolean b) {
|
||||
isStatisticsEnabled = b;
|
||||
}
|
||||
|
@ -743,6 +765,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
* @return Returns the max query execution time,
|
||||
* for all queries
|
||||
*/
|
||||
@Override
|
||||
public long getQueryExecutionMaxTime() {
|
||||
return queryExecutionMaxTime.get();
|
||||
}
|
||||
|
@ -750,6 +773,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* Get all executed query strings
|
||||
*/
|
||||
@Override
|
||||
public String[] getQueries() {
|
||||
return ArrayHelper.toStringArray( queryStatistics.keySet() );
|
||||
}
|
||||
|
@ -757,6 +781,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* Get the names of all entities
|
||||
*/
|
||||
@Override
|
||||
public String[] getEntityNames() {
|
||||
if ( sessionFactory == null ) {
|
||||
return ArrayHelper.toStringArray( entityStatistics.keySet() );
|
||||
|
@ -769,6 +794,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* Get the names of all collection roles
|
||||
*/
|
||||
@Override
|
||||
public String[] getCollectionRoleNames() {
|
||||
if ( sessionFactory == null ) {
|
||||
return ArrayHelper.toStringArray( collectionStatistics.keySet() );
|
||||
|
@ -781,6 +807,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
/**
|
||||
* Get all second-level cache region names
|
||||
*/
|
||||
@Override
|
||||
public String[] getSecondLevelCacheRegionNames() {
|
||||
if ( sessionFactory == null ) {
|
||||
return ArrayHelper.toStringArray( secondLevelCacheStatistics.keySet() );
|
||||
|
@ -789,43 +816,43 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
return ArrayHelper.toStringArray( sessionFactory.getAllSecondLevelCacheRegions().keySet() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(boolean success) {
|
||||
transactionCount.getAndIncrement();
|
||||
if ( success ) {
|
||||
committedTransactionCount.getAndIncrement();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSuccessfulTransactionCount() {
|
||||
return committedTransactionCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTransactionCount() {
|
||||
return transactionCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeStatement() {
|
||||
closeStatementCount.getAndIncrement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareStatement() {
|
||||
prepareStatementCount.getAndIncrement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCloseStatementCount() {
|
||||
return closeStatementCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPrepareStatementCount() {
|
||||
return prepareStatementCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optimisticFailure(String entityName) {
|
||||
optimisticFailureCount.getAndIncrement();
|
||||
( (ConcurrentEntityStatisticsImpl) getEntityStatistics( entityName ) ).incrementOptimisticFailureCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getOptimisticFailureCount() {
|
||||
return optimisticFailureCount.get();
|
||||
}
|
||||
|
@ -873,7 +900,7 @@ public class ConcurrentStatisticsImpl implements StatisticsImplementor, Service
|
|||
.append( ']' )
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryExecutionMaxTimeQueryString() {
|
||||
return queryExecutionMaxTimeQueryString;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class BooleanType
|
|||
protected BooleanType(SqlTypeDescriptor sqlTypeDescriptor, BooleanTypeDescriptor javaTypeDescriptor) {
|
||||
super( sqlTypeDescriptor, javaTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "boolean";
|
||||
}
|
||||
|
@ -56,22 +56,22 @@ public class BooleanType
|
|||
public String[] getRegistrationKeys() {
|
||||
return new String[] { getName(), boolean.class.getName(), Boolean.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean stringToObject(String string) {
|
||||
return fromString( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public String objectToSQLString(Boolean value, Dialect dialect) {
|
||||
return dialect.toBooleanValueString( value.booleanValue() );
|
||||
return dialect.toBooleanValueString( value );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,19 +37,18 @@ import org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor;
|
|||
* @author Gavin King
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public class ByteType
|
||||
extends AbstractSingleColumnStandardBasicType<Byte>
|
||||
implements PrimitiveType<Byte>, DiscriminatorType<Byte>, VersionType<Byte> {
|
||||
|
||||
public static final ByteType INSTANCE = new ByteType();
|
||||
|
||||
private static final Byte ZERO = Byte.valueOf( (byte)0 );
|
||||
private static final Byte ZERO = (byte) 0;
|
||||
|
||||
public ByteType() {
|
||||
super( TinyIntTypeDescriptor.INSTANCE, ByteTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "byte";
|
||||
}
|
||||
|
@ -58,36 +57,35 @@ public class ByteType
|
|||
public String[] getRegistrationKeys() {
|
||||
return new String[] { getName(), byte.class.getName(), Byte.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return byte.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(Byte value, Dialect dialect) {
|
||||
return toString( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte stringToObject(String xml) {
|
||||
return fromString( xml );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte fromStringValue(String xml) {
|
||||
return fromString( xml );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public Byte next(Byte current, SessionImplementor session) {
|
||||
return Byte.valueOf( (byte) ( current.byteValue() + 1 ) );
|
||||
return (byte) ( current + 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte seed(SessionImplementor session) {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<Byte> getComparator() {
|
||||
return getJavaTypeDescriptor().getComparator();
|
||||
}
|
||||
|
|
|
@ -37,13 +37,12 @@ import org.hibernate.type.descriptor.java.DoubleTypeDescriptor;
|
|||
public class DoubleType extends AbstractSingleColumnStandardBasicType<Double> implements PrimitiveType<Double> {
|
||||
public static final DoubleType INSTANCE = new DoubleType();
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public static final Double ZERO = Double.valueOf( 0.0 );
|
||||
public static final Double ZERO = 0.0;
|
||||
|
||||
public DoubleType() {
|
||||
super( org.hibernate.type.descriptor.sql.DoubleTypeDescriptor.INSTANCE, DoubleTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "double";
|
||||
}
|
||||
|
@ -52,15 +51,15 @@ public class DoubleType extends AbstractSingleColumnStandardBasicType<Double> im
|
|||
public String[] getRegistrationKeys() {
|
||||
return new String[] { getName(), double.class.getName(), Double.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return double.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(Double value, Dialect dialect) throws Exception {
|
||||
return toString( value );
|
||||
}
|
||||
|
|
|
@ -37,13 +37,12 @@ import org.hibernate.type.descriptor.java.FloatTypeDescriptor;
|
|||
public class FloatType extends AbstractSingleColumnStandardBasicType<Float> implements PrimitiveType<Float> {
|
||||
public static final FloatType INSTANCE = new FloatType();
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public static final Float ZERO = Float.valueOf( 0.0f );
|
||||
public static final Float ZERO = 0.0f;
|
||||
|
||||
public FloatType() {
|
||||
super( org.hibernate.type.descriptor.sql.FloatTypeDescriptor.INSTANCE, FloatTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "float";
|
||||
}
|
||||
|
@ -52,15 +51,15 @@ public class FloatType extends AbstractSingleColumnStandardBasicType<Float> impl
|
|||
public String[] getRegistrationKeys() {
|
||||
return new String[] { getName(), float.class.getName(), Float.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return float.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(Float value, Dialect dialect) throws Exception {
|
||||
return toString( value );
|
||||
}
|
||||
|
|
|
@ -41,13 +41,12 @@ public class IntegerType extends AbstractSingleColumnStandardBasicType<Integer>
|
|||
|
||||
public static final IntegerType INSTANCE = new IntegerType();
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public static final Integer ZERO = Integer.valueOf( 0 );
|
||||
public static final Integer ZERO = 0;
|
||||
|
||||
public IntegerType() {
|
||||
super( org.hibernate.type.descriptor.sql.IntegerTypeDescriptor.INSTANCE, IntegerTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "integer";
|
||||
}
|
||||
|
@ -56,32 +55,31 @@ public class IntegerType extends AbstractSingleColumnStandardBasicType<Integer>
|
|||
public String[] getRegistrationKeys() {
|
||||
return new String[] { getName(), int.class.getName(), Integer.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return int.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(Integer value, Dialect dialect) throws Exception {
|
||||
return toString( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer stringToObject(String xml) {
|
||||
return fromString( xml );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer seed(SessionImplementor session) {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public Integer next(Integer current, SessionImplementor session) {
|
||||
return current+1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<Integer> getComparator() {
|
||||
return getJavaTypeDescriptor().getComparator();
|
||||
}
|
||||
|
|
|
@ -43,13 +43,12 @@ public class LongType
|
|||
|
||||
public static final LongType INSTANCE = new LongType();
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
private static final Long ZERO = Long.valueOf( 0 );
|
||||
private static final Long ZERO = (long) 0;
|
||||
|
||||
public LongType() {
|
||||
super( BigIntTypeDescriptor.INSTANCE, LongTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "long";
|
||||
}
|
||||
|
@ -58,32 +57,31 @@ public class LongType
|
|||
public String[] getRegistrationKeys() {
|
||||
return new String[] { getName(), long.class.getName(), Long.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return long.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long stringToObject(String xml) throws Exception {
|
||||
return Long.valueOf( xml );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public Long next(Long current, SessionImplementor session) {
|
||||
return current + 1l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long seed(SessionImplementor session) {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<Long> getComparator() {
|
||||
return getJavaTypeDescriptor().getComparator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(Long value, Dialect dialect) throws Exception {
|
||||
return value.toString();
|
||||
}
|
||||
|
|
|
@ -43,25 +43,24 @@ public class NumericBooleanType
|
|||
public NumericBooleanType() {
|
||||
super( IntegerTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "numeric_boolean";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean stringToObject(String string) {
|
||||
return fromString( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public String objectToSQLString(Boolean value, Dialect dialect) {
|
||||
return value.booleanValue() ? "1" : "0";
|
||||
return value ? "1" : "0";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,12 @@ public class ShortType
|
|||
|
||||
public static final ShortType INSTANCE = new ShortType();
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
private static final Short ZERO = Short.valueOf( (short) 0 );
|
||||
private static final Short ZERO = (short) 0;
|
||||
|
||||
public ShortType() {
|
||||
super( SmallIntTypeDescriptor.INSTANCE, ShortTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "short";
|
||||
}
|
||||
|
@ -58,32 +57,31 @@ public class ShortType
|
|||
public String[] getRegistrationKeys() {
|
||||
return new String[] { getName(), short.class.getName(), Short.class.getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return short.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(Short value, Dialect dialect) throws Exception {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short stringToObject(String xml) throws Exception {
|
||||
return Short.valueOf( xml );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public Short next(Short current, SessionImplementor session) {
|
||||
return Short.valueOf( (short) ( current.shortValue() + 1 ) );
|
||||
return (short) ( current + 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short seed(SessionImplementor session) {
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<Short> getComparator() {
|
||||
return getJavaTypeDescriptor().getComparator();
|
||||
}
|
||||
|
|
|
@ -44,26 +44,25 @@ public class TrueFalseType
|
|||
public TrueFalseType() {
|
||||
super( CharTypeDescriptor.INSTANCE, new BooleanTypeDescriptor( 'T', 'F' ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "true_false";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean stringToObject(String xml) throws Exception {
|
||||
return fromString( xml );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public String objectToSQLString(Boolean value, Dialect dialect) throws Exception {
|
||||
return StringType.INSTANCE.objectToSQLString( value.booleanValue() ? "T" : "F", dialect );
|
||||
return StringType.INSTANCE.objectToSQLString( value ? "T" : "F", dialect );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,25 +44,24 @@ public class YesNoType
|
|||
public YesNoType() {
|
||||
super( CharTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "yes_no";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getPrimitiveClass() {
|
||||
return boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean stringToObject(String xml) throws Exception {
|
||||
return fromString( xml );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getDefaultValue() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public String objectToSQLString(Boolean value, Dialect dialect) throws Exception {
|
||||
return StringType.INSTANCE.objectToSQLString( value.booleanValue() ? "Y" : "N", dialect );
|
||||
return StringType.INSTANCE.objectToSQLString( value ? "Y" : "N", dialect );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,16 +58,17 @@ public class BooleanTypeDescriptor extends AbstractTypeDescriptor<Boolean> {
|
|||
stringValueTrue = String.valueOf( characterValueTrue );
|
||||
stringValueFalse = String.valueOf( characterValueFalse );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Boolean value) {
|
||||
return value == null ? null : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean fromString(String string) {
|
||||
return Boolean.valueOf( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Boolean value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -95,8 +96,7 @@ public class BooleanTypeDescriptor extends AbstractTypeDescriptor<Boolean> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public <X> Boolean wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -109,7 +109,7 @@ public class BooleanTypeDescriptor extends AbstractTypeDescriptor<Boolean> {
|
|||
return intValue == 0 ? FALSE : TRUE;
|
||||
}
|
||||
if ( Character.class.isInstance( value ) ) {
|
||||
return isTrue( ( (Character) value ).charValue() ) ? TRUE : FALSE;
|
||||
return isTrue( (Character) value ) ? TRUE : FALSE;
|
||||
}
|
||||
if ( String.class.isInstance( value ) ) {
|
||||
return isTrue( ( (String) value ).charAt( 0 ) ) ? TRUE : FALSE;
|
||||
|
@ -125,23 +125,19 @@ public class BooleanTypeDescriptor extends AbstractTypeDescriptor<Boolean> {
|
|||
return value ? 1 : 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public Byte toByte(Boolean value) {
|
||||
return Byte.valueOf( (byte) toInt( value ) );
|
||||
return (byte) toInt( value );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public Short toShort(Boolean value) {
|
||||
return Short.valueOf( (short ) toInt( value ) );
|
||||
return (short) toInt( value );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public Integer toInteger(Boolean value) {
|
||||
return Integer.valueOf( toInt( value ) );
|
||||
return toInt( value );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
public Long toLong(Boolean value) {
|
||||
return Long.valueOf( toInt( value ) );
|
||||
return (long) toInt( value );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,12 +45,11 @@ public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
|
|||
public ByteArrayTypeDescriptor() {
|
||||
super( Byte[].class, ArrayMutabilityPlan.INSTANCE );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public String toString(Byte[] bytes) {
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
for ( Byte aByte : bytes ) {
|
||||
final String hexStr = Integer.toHexString( aByte.byteValue() - Byte.MIN_VALUE );
|
||||
final String hexStr = Integer.toHexString( aByte - Byte.MIN_VALUE );
|
||||
if ( hexStr.length() == 1 ) {
|
||||
buf.append( '0' );
|
||||
}
|
||||
|
@ -58,8 +57,7 @@ public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
|
|||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public Byte[] fromString(String string) {
|
||||
if ( string == null ) {
|
||||
return null;
|
||||
|
@ -70,12 +68,13 @@ public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
|
|||
Byte[] bytes = new Byte[string.length() / 2];
|
||||
for ( int i = 0; i < bytes.length; i++ ) {
|
||||
final String hexStr = string.substring( i * 2, (i + 1) * 2 );
|
||||
bytes[i] = Byte.valueOf( (byte) (Integer.parseInt(hexStr, 16) + Byte.MIN_VALUE) );
|
||||
bytes[i] = (byte) ( Integer.parseInt( hexStr, 16 ) + Byte.MIN_VALUE );
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Byte[] value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -98,7 +97,7 @@ public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
|
|||
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> Byte[] wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -124,26 +123,24 @@ public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
|
|||
throw unknownWrap( value.getClass() );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
private Byte[] wrapBytes(byte[] bytes) {
|
||||
if ( bytes == null ) {
|
||||
return null;
|
||||
}
|
||||
final Byte[] result = new Byte[bytes.length];
|
||||
for ( int i = 0; i < bytes.length; i++ ) {
|
||||
result[i] = Byte.valueOf( bytes[i] );
|
||||
result[i] = bytes[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
private byte[] unwrapBytes(Byte[] bytes) {
|
||||
if ( bytes == null ) {
|
||||
return null;
|
||||
}
|
||||
final byte[] result = new byte[bytes.length];
|
||||
for ( int i = 0; i < bytes.length; i++ ) {
|
||||
result[i] = bytes[i].byteValue();
|
||||
result[i] = bytes[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -37,15 +37,17 @@ public class ByteTypeDescriptor extends AbstractTypeDescriptor<Byte> {
|
|||
super( Byte.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Byte value) {
|
||||
return value == null ? null : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte fromString(String string) {
|
||||
return Byte.valueOf( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Byte value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -73,8 +75,7 @@ public class ByteTypeDescriptor extends AbstractTypeDescriptor<Byte> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public <X> Byte wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -83,7 +84,7 @@ public class ByteTypeDescriptor extends AbstractTypeDescriptor<Byte> {
|
|||
return (Byte) value;
|
||||
}
|
||||
if ( Number.class.isInstance( value ) ) {
|
||||
return Byte.valueOf( ( (Number) value ).byteValue() );
|
||||
return ( (Number) value ).byteValue();
|
||||
}
|
||||
if ( String.class.isInstance( value ) ) {
|
||||
return Byte.valueOf( ( (String) value ) );
|
||||
|
|
|
@ -44,11 +44,11 @@ public class CharacterArrayTypeDescriptor extends AbstractTypeDescriptor<Charact
|
|||
public CharacterArrayTypeDescriptor() {
|
||||
super( Character[].class, ArrayMutabilityPlan.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Character[] value) {
|
||||
return new String( unwrapChars( value ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Character[] fromString(String string) {
|
||||
return wrapChars( string.toCharArray() );
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ public class CharacterArrayTypeDescriptor extends AbstractTypeDescriptor<Charact
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Character[] value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -90,7 +91,7 @@ public class CharacterArrayTypeDescriptor extends AbstractTypeDescriptor<Charact
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> Character[] wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -110,26 +111,24 @@ public class CharacterArrayTypeDescriptor extends AbstractTypeDescriptor<Charact
|
|||
throw unknownWrap( value.getClass() );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
private Character[] wrapChars(char[] chars) {
|
||||
if ( chars == null ) {
|
||||
return null;
|
||||
}
|
||||
final Character[] result = new Character[chars.length];
|
||||
for ( int i = 0; i < chars.length; i++ ) {
|
||||
result[i] = Character.valueOf( chars[i] );
|
||||
result[i] = chars[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
private char[] unwrapChars(Character[] chars) {
|
||||
if ( chars == null ) {
|
||||
return null;
|
||||
}
|
||||
final char[] result = new char[chars.length];
|
||||
for ( int i = 0; i < chars.length; i++ ) {
|
||||
result[i] = chars[i].charValue();
|
||||
result[i] = chars[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -36,20 +36,20 @@ public class CharacterTypeDescriptor extends AbstractTypeDescriptor<Character> {
|
|||
public CharacterTypeDescriptor() {
|
||||
super( Character.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Character value) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public Character fromString(String string) {
|
||||
if ( string.length() != 1 ) {
|
||||
throw new HibernateException( "multiple or zero characters found parsing string" );
|
||||
}
|
||||
return Character.valueOf( string.charAt( 0 ) );
|
||||
return string.charAt( 0 );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Character value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -65,8 +65,7 @@ public class CharacterTypeDescriptor extends AbstractTypeDescriptor<Character> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public <X> Character wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -76,11 +75,11 @@ public class CharacterTypeDescriptor extends AbstractTypeDescriptor<Character> {
|
|||
}
|
||||
if ( String.class.isInstance( value ) ) {
|
||||
final String str = (String) value;
|
||||
return Character.valueOf( str.charAt(0) );
|
||||
return str.charAt( 0 );
|
||||
}
|
||||
if ( Number.class.isInstance( value ) ) {
|
||||
final Number nbr = (Number) value;
|
||||
return Character.valueOf( (char)nbr.shortValue() );
|
||||
return (char) nbr.shortValue();
|
||||
}
|
||||
throw unknownWrap( value.getClass() );
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class DateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
|
||||
public static class DateMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||
public static final DateMutabilityPlan INSTANCE = new DateMutabilityPlan();
|
||||
|
||||
@Override
|
||||
public Date deepCopyNotNull(Date value) {
|
||||
return new Date( value.getTime() );
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ public class DateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
public DateTypeDescriptor() {
|
||||
super( Date.class, DateMutabilityPlan.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Date value) {
|
||||
return new SimpleDateFormat( DATE_FORMAT ).format( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date fromString(String string) {
|
||||
try {
|
||||
return new SimpleDateFormat(DATE_FORMAT).parse( string );
|
||||
|
@ -71,11 +71,8 @@ public class DateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
if ( one == another) {
|
||||
return true;
|
||||
}
|
||||
if ( one == null || another == null ) {
|
||||
return false;
|
||||
}
|
||||
return !( one == null || another == null ) && one.getTime() == another.getTime();
|
||||
|
||||
return one.getTime() == another.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,6 +83,7 @@ public class DateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -121,8 +119,7 @@ public class DateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public <X> Date wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -132,7 +129,7 @@ public class DateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
|
||||
if ( Long.class.isInstance( value ) ) {
|
||||
return new Date( ( (Long) value ).longValue() );
|
||||
return new Date( (Long) value );
|
||||
}
|
||||
|
||||
if ( Calendar.class.isInstance( value ) ) {
|
||||
|
|
|
@ -39,16 +39,17 @@ public class DoubleTypeDescriptor extends AbstractTypeDescriptor<Double> {
|
|||
public DoubleTypeDescriptor() {
|
||||
super( Double.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Double value) {
|
||||
return value == null ? null : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double fromString(String string) {
|
||||
return Double.valueOf( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Double value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -82,8 +83,7 @@ public class DoubleTypeDescriptor extends AbstractTypeDescriptor<Double> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public <X> Double wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -92,7 +92,7 @@ public class DoubleTypeDescriptor extends AbstractTypeDescriptor<Double> {
|
|||
return (Double) value;
|
||||
}
|
||||
if ( Number.class.isInstance( value ) ) {
|
||||
return Double.valueOf( ( (Number) value ).doubleValue() );
|
||||
return ( (Number) value ).doubleValue();
|
||||
}
|
||||
else if ( String.class.isInstance( value ) ) {
|
||||
return Double.valueOf( ( (String) value ) );
|
||||
|
|
|
@ -39,16 +39,17 @@ public class FloatTypeDescriptor extends AbstractTypeDescriptor<Float> {
|
|||
public FloatTypeDescriptor() {
|
||||
super( Float.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Float value) {
|
||||
return value == null ? null : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float fromString(String string) {
|
||||
return Float.valueOf( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Float value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -82,8 +83,7 @@ public class FloatTypeDescriptor extends AbstractTypeDescriptor<Float> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public <X> Float wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -92,7 +92,7 @@ public class FloatTypeDescriptor extends AbstractTypeDescriptor<Float> {
|
|||
return (Float) value;
|
||||
}
|
||||
if ( Number.class.isInstance( value ) ) {
|
||||
return Float.valueOf( ( (Number) value ).floatValue() );
|
||||
return ( (Number) value ).floatValue();
|
||||
}
|
||||
else if ( String.class.isInstance( value ) ) {
|
||||
return Float.valueOf( ( (String) value ) );
|
||||
|
|
|
@ -39,16 +39,17 @@ public class IntegerTypeDescriptor extends AbstractTypeDescriptor<Integer> {
|
|||
public IntegerTypeDescriptor() {
|
||||
super( Integer.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Integer value) {
|
||||
return value == null ? null : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer fromString(String string) {
|
||||
return string == null ? null : Integer.valueOf( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Integer value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -82,8 +83,7 @@ public class IntegerTypeDescriptor extends AbstractTypeDescriptor<Integer> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public <X> Integer wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -92,7 +92,7 @@ public class IntegerTypeDescriptor extends AbstractTypeDescriptor<Integer> {
|
|||
return (Integer) value;
|
||||
}
|
||||
if ( Number.class.isInstance( value ) ) {
|
||||
return Integer.valueOf( ( (Number) value ).intValue() );
|
||||
return ( (Number) value ).intValue();
|
||||
}
|
||||
if ( String.class.isInstance( value ) ) {
|
||||
return Integer.valueOf( ( (String) value ) );
|
||||
|
|
|
@ -43,7 +43,7 @@ public class JdbcDateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
|
||||
public static class DateMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||
public static final DateMutabilityPlan INSTANCE = new DateMutabilityPlan();
|
||||
|
||||
@Override
|
||||
public Date deepCopyNotNull(Date value) {
|
||||
return java.sql.Date.class.isInstance( value )
|
||||
? new java.sql.Date( value.getTime() )
|
||||
|
@ -54,11 +54,11 @@ public class JdbcDateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
public JdbcDateTypeDescriptor() {
|
||||
super( Date.class, DateMutabilityPlan.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Date value) {
|
||||
return new SimpleDateFormat( DATE_FORMAT ).format( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date fromString(String string) {
|
||||
try {
|
||||
return new Date( new SimpleDateFormat(DATE_FORMAT).parse( string ).getTime() );
|
||||
|
@ -103,6 +103,7 @@ public class JdbcDateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -138,8 +139,7 @@ public class JdbcDateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public <X> Date wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
|
|
@ -44,7 +44,7 @@ public class JdbcTimeTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
|
||||
public static class TimeMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||
public static final TimeMutabilityPlan INSTANCE = new TimeMutabilityPlan();
|
||||
|
||||
@Override
|
||||
public Date deepCopyNotNull(Date value) {
|
||||
return Time.class.isInstance( value )
|
||||
? new Time( value.getTime() )
|
||||
|
@ -55,11 +55,11 @@ public class JdbcTimeTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
public JdbcTimeTypeDescriptor() {
|
||||
super( Date.class, TimeMutabilityPlan.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Date value) {
|
||||
return new SimpleDateFormat( TIME_FORMAT ).format( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.Date fromString(String string) {
|
||||
try {
|
||||
return new Time( new SimpleDateFormat( TIME_FORMAT ).parse( string ).getTime() );
|
||||
|
@ -106,6 +106,7 @@ public class JdbcTimeTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -141,8 +142,7 @@ public class JdbcTimeTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public <X> Date wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -152,7 +152,7 @@ public class JdbcTimeTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
|
||||
if ( Long.class.isInstance( value ) ) {
|
||||
return new Time( ( (Long) value ).longValue() );
|
||||
return new Time( (Long) value );
|
||||
}
|
||||
|
||||
if ( Calendar.class.isInstance( value ) ) {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class JdbcTimestampTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
|
||||
public static class TimestampMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||
public static final TimestampMutabilityPlan INSTANCE = new TimestampMutabilityPlan();
|
||||
|
||||
@Override
|
||||
public Date deepCopyNotNull(Date value) {
|
||||
if ( value instanceof Timestamp ) {
|
||||
Timestamp orig = (Timestamp) value;
|
||||
|
@ -61,11 +61,11 @@ public class JdbcTimestampTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
public JdbcTimestampTypeDescriptor() {
|
||||
super( Date.class, TimestampMutabilityPlan.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Date value) {
|
||||
return new SimpleDateFormat( TIMESTAMP_FORMAT ).format( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date fromString(String string) {
|
||||
try {
|
||||
return new Timestamp( new SimpleDateFormat( TIMESTAMP_FORMAT ).parse( string ).getTime() );
|
||||
|
@ -115,6 +115,7 @@ public class JdbcTimestampTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -150,8 +151,7 @@ public class JdbcTimestampTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
||||
@Override
|
||||
public <X> Date wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -161,7 +161,7 @@ public class JdbcTimestampTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||
}
|
||||
|
||||
if ( Long.class.isInstance( value ) ) {
|
||||
return new Timestamp( ( (Long) value ).longValue() );
|
||||
return new Timestamp( (Long) value );
|
||||
}
|
||||
|
||||
if ( Calendar.class.isInstance( value ) ) {
|
||||
|
|
|
@ -39,16 +39,17 @@ public class LongTypeDescriptor extends AbstractTypeDescriptor<Long> {
|
|||
public LongTypeDescriptor() {
|
||||
super( Long.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Long value) {
|
||||
return value == null ? null : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long fromString(String string) {
|
||||
return Long.valueOf( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Long value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -82,8 +83,7 @@ public class LongTypeDescriptor extends AbstractTypeDescriptor<Long> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public <X> Long wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -92,7 +92,7 @@ public class LongTypeDescriptor extends AbstractTypeDescriptor<Long> {
|
|||
return (Long) value;
|
||||
}
|
||||
if ( Number.class.isInstance( value ) ) {
|
||||
return Long.valueOf( ( (Number) value ).longValue() );
|
||||
return ( (Number) value ).longValue();
|
||||
}
|
||||
else if ( String.class.isInstance( value ) ) {
|
||||
return Long.valueOf( ( (String) value ) );
|
||||
|
|
|
@ -35,16 +35,17 @@ public class ShortTypeDescriptor extends AbstractTypeDescriptor<Short> {
|
|||
public ShortTypeDescriptor() {
|
||||
super( Short.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(Short value) {
|
||||
return value == null ? null : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short fromString(String string) {
|
||||
return Short.valueOf( string );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public <X> X unwrap(Short value, Class<X> type, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -72,8 +73,7 @@ public class ShortTypeDescriptor extends AbstractTypeDescriptor<Short> {
|
|||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
@Override
|
||||
public <X> Short wrap(X value, WrapperOptions options) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
|
@ -82,7 +82,7 @@ public class ShortTypeDescriptor extends AbstractTypeDescriptor<Short> {
|
|||
return (Short) value;
|
||||
}
|
||||
if ( Number.class.isInstance( value ) ) {
|
||||
return Short.valueOf( ( (Number) value ).shortValue() );
|
||||
return ( (Number) value ).shortValue();
|
||||
}
|
||||
if ( String.class.isInstance( value ) ) {
|
||||
return Short.valueOf( ( (String) value ) );
|
||||
|
|
|
@ -45,12 +45,11 @@ public class JdbcTypeFamilyInformation {
|
|||
|
||||
private final int[] typeCodes;
|
||||
|
||||
@SuppressWarnings("UnnecessaryBoxing")
|
||||
private Family(int... typeCodes) {
|
||||
this.typeCodes = typeCodes;
|
||||
|
||||
for ( int typeCode : typeCodes ) {
|
||||
JdbcTypeFamilyInformation.INSTANCE.typeCodeToFamilyMap.put( Integer.valueOf( typeCode ), this );
|
||||
for ( final int typeCode : typeCodes ) {
|
||||
JdbcTypeFamilyInformation.INSTANCE.typeCodeToFamilyMap.put( typeCode, this );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +67,6 @@ public class JdbcTypeFamilyInformation {
|
|||
*
|
||||
* @return The family of datatypes the type code belongs to, or {@code null} if it belongs to no known families.
|
||||
*/
|
||||
@SuppressWarnings("UnnecessaryBoxing")
|
||||
public Family locateJdbcTypeFamilyByTypeCode(int typeCode) {
|
||||
return typeCodeToFamilyMap.get( Integer.valueOf( typeCode ) );
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ public class JdbcTypeJavaClassMappings {
|
|||
private JdbcTypeJavaClassMappings() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public int determineJdbcTypeCodeForJavaClass(Class cls) {
|
||||
Integer typeCode = JdbcTypeJavaClassMappings.javaClassToJdbcTypeCodeMap.get( cls );
|
||||
if ( typeCode != null ) {
|
||||
|
@ -72,7 +71,6 @@ public class JdbcTypeJavaClassMappings {
|
|||
return specialCode;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnnecessaryUnboxing")
|
||||
public Class determineJavaClassForJdbcTypeCode(int typeCode) {
|
||||
Class cls = jdbcTypeCodeToJavaClassMap.get( Integer.valueOf( typeCode ) );
|
||||
if ( cls != null ) {
|
||||
|
|
|
@ -50,12 +50,10 @@ public class SqlTypeDescriptorRegistry {
|
|||
|
||||
private ConcurrentHashMap<Integer,SqlTypeDescriptor> descriptorMap = new ConcurrentHashMap<Integer, SqlTypeDescriptor>();
|
||||
|
||||
@SuppressWarnings("UnnecessaryBoxing")
|
||||
public void addDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
descriptorMap.put( Integer.valueOf( sqlTypeDescriptor.getSqlType() ), sqlTypeDescriptor );
|
||||
descriptorMap.put( sqlTypeDescriptor.getSqlType(), sqlTypeDescriptor );
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnnecessaryBoxing")
|
||||
public SqlTypeDescriptor getDescriptor(int jdbcTypeCode) {
|
||||
SqlTypeDescriptor descriptor = descriptorMap.get( Integer.valueOf( jdbcTypeCode ) );
|
||||
if ( descriptor != null ) {
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.sql.SQLException;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public class Mocks {
|
||||
|
||||
public static Connection createConnection(String databaseName, int majorVersion) {
|
||||
|
|
|
@ -48,7 +48,6 @@ public class CascadeTestWithAssignedParentIdTest extends BaseCoreFunctionalTestC
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testSaveChildWithParent() {
|
||||
Session session = openSession();
|
||||
Transaction txn = session.beginTransaction();
|
||||
|
|
|
@ -78,7 +78,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testDialectSQLFunctions() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -138,7 +137,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
||||
public void testSetProperties() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -173,7 +171,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testBroken() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -205,7 +202,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testNothinToUpdate() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -229,7 +225,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCachedQuery() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -290,7 +285,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCachedQueryRegion() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -344,7 +338,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
||||
public void testSQLFunctions() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -542,7 +535,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testSqlFunctionAsAlias() throws Exception {
|
||||
String functionName = locateAppropriateDialectFunctionNameForAliasTest();
|
||||
if (functionName == null) {
|
||||
|
@ -583,7 +575,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCachedQueryOnInsert() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -638,7 +629,6 @@ public class SQLFunctionsInterSystemsTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "UnnecessaryUnboxing"})
|
||||
public void testInterSystemsFunctions() throws Exception {
|
||||
Calendar cal = new GregorianCalendar();
|
||||
cal.set(1977,6,3,0,0,0);
|
||||
|
|
|
@ -50,7 +50,6 @@ public class JoinedFilteredBulkManipulationTest extends BaseCoreFunctionalTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testFilteredJoinedSubclassHqlDeleteRoot() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -77,7 +76,6 @@ public class JoinedFilteredBulkManipulationTest extends BaseCoreFunctionalTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testFilteredJoinedSubclassHqlDeleteNonLeaf() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -104,7 +102,6 @@ public class JoinedFilteredBulkManipulationTest extends BaseCoreFunctionalTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testFilteredJoinedSubclassHqlDeleteLeaf() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -131,7 +128,6 @@ public class JoinedFilteredBulkManipulationTest extends BaseCoreFunctionalTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testFilteredJoinedSubclassHqlUpdateRoot() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -158,7 +154,6 @@ public class JoinedFilteredBulkManipulationTest extends BaseCoreFunctionalTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testFilteredJoinedSubclassHqlUpdateNonLeaf() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -188,7 +183,6 @@ public class JoinedFilteredBulkManipulationTest extends BaseCoreFunctionalTestCa
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testFilteredJoinedSubclassHqlUpdateLeaf() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
|
|
@ -1161,7 +1161,6 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
@FailureExpected( jiraKey = "unknown" )
|
||||
public void testParameterTypeMismatch() {
|
||||
Session s = openSession();
|
||||
|
@ -1478,7 +1477,6 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public void testArithmetic() {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -1796,7 +1794,6 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testNumericExpressionReturnTypes() {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -1959,7 +1956,6 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testIndexParams() {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -1992,7 +1988,6 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
@Test
|
||||
@SkipForDialect( value = SybaseASE15Dialect.class, jiraKey = "HHH-6424")
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public void testAggregation() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
|
|
@ -416,7 +416,6 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase {
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
@Test
|
||||
public void testInsertWithGeneratedVersionAndId() {
|
||||
// Make sure the env supports bulk inserts with generated ids...
|
||||
|
@ -466,7 +465,6 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
@RequiresDialectFeature(
|
||||
value = DialectChecks.SupportsParametersInInsertSelectCheck.class,
|
||||
comment = "dialect does not support parameter in INSERT ... SELECT"
|
||||
|
@ -701,7 +699,6 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public void testUpdateOnComponent() {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
@ -792,7 +789,6 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public void testUpdateOnDiscriminatorSubclass() {
|
||||
TestData data = new TestData();
|
||||
data.prepare();
|
||||
|
@ -1017,7 +1013,6 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
@RequiresDialectFeature(
|
||||
value = DialectChecks.HasSelfReferentialForeignKeyBugCheck.class,
|
||||
comment = "self referential FK bug"
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.test.hql;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -227,8 +228,8 @@ public abstract class QueryTranslatorTestCase extends BaseCoreFunctionalTestCase
|
|||
|
||||
private void checkQuerySpaces(QueryTranslator oldQueryTranslator, QueryTranslator newQueryTranslator) {
|
||||
// Check the query spaces for a regression.
|
||||
Set oldQuerySpaces = oldQueryTranslator.getQuerySpaces();
|
||||
Set querySpaces = newQueryTranslator.getQuerySpaces();
|
||||
Set<Serializable> oldQuerySpaces = oldQueryTranslator.getQuerySpaces();
|
||||
Set<Serializable> querySpaces = newQueryTranslator.getQuerySpaces();
|
||||
assertEquals( "Query spaces is not the right size!", oldQuerySpaces.size(), querySpaces.size() );
|
||||
for ( Object o : oldQuerySpaces ) {
|
||||
assertTrue( "New query space does not contain " + o + "!", querySpaces.contains( o ) );
|
||||
|
@ -280,7 +281,6 @@ public abstract class QueryTranslatorTestCase extends BaseCoreFunctionalTestCase
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "UnnecessaryUnboxing"})
|
||||
private Map getTokens(String sql) {
|
||||
Map<String,Integer> result = new TreeMap<String,Integer>();
|
||||
if ( sql == null ) {
|
||||
|
|
|
@ -86,7 +86,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testUpdateProperty() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -135,7 +134,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCreateWithNonEmptyOneToManyCollectionOfNew() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -171,7 +169,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCreateWithNonEmptyOneToManyCollectionOfExisting() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -227,7 +224,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testAddNewOneToManyElementToPersistentEntity() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -274,7 +270,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testAddExistingOneToManyElementToPersistentEntity() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -335,7 +330,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -393,7 +387,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCreateWithNonEmptyOneToManyCollectionUpdateWithNewElement() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -453,7 +446,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testCreateWithEmptyOneToManyCollectionMergeWithExistingElement() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -511,7 +503,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testCreateWithNonEmptyOneToManyCollectionMergeWithNewElement() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -568,7 +559,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testMoveOneToManyElementToNewEntityCollection() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -638,7 +628,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testMoveOneToManyElementToExistingEntityCollection() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -709,7 +698,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testRemoveOneToManyElementUsingUpdate() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -774,7 +762,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testRemoveOneToManyElementUsingMerge() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -839,7 +826,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testDeleteOneToManyElement() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -886,7 +872,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testRemoveOneToManyElementByDelete() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -936,7 +921,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testRemoveOneToManyOrphanUsingUpdate() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -988,7 +972,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testRemoveOneToManyOrphanUsingMerge() {
|
||||
Contract c = new Contract( null, "gail", "phone");
|
||||
ContractVariation cv = new ContractVariation( 1, c );
|
||||
|
@ -1038,7 +1021,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testDeleteOneToManyOrphan() {
|
||||
clearCounts();
|
||||
|
||||
|
@ -1085,7 +1067,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
assertDeleteCount( 1 );
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
@Test
|
||||
public void testOneToManyCollectionOptimisticLockingWithMerge() {
|
||||
clearCounts();
|
||||
|
@ -1143,7 +1124,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
|
|||
assertDeleteCount( 3 );
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
@Test
|
||||
public void testOneToManyCollectionOptimisticLockingWithUpdate() {
|
||||
clearCounts();
|
||||
|
|
|
@ -35,7 +35,6 @@ import static org.junit.Assert.assertNotNull;
|
|||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public class ABCTest extends LegacyTestCase {
|
||||
public String[] getMappings() {
|
||||
return new String[] { "legacy/ABC.hbm.xml", "legacy/ABCExtends.hbm.xml" };
|
||||
|
|
|
@ -41,7 +41,6 @@ public class CustomSQLTest extends LegacyTestCase {
|
|||
@Test
|
||||
@RequiresDialectFeature( NonIdentityGeneratorChecker.class )
|
||||
@SkipForDialect( value = {PostgreSQL81Dialect.class, PostgreSQLDialect.class}, jiraKey = "HHH-6704")
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testInsert() throws HibernateException, SQLException {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -85,7 +84,6 @@ public class CustomSQLTest extends LegacyTestCase {
|
|||
}
|
||||
|
||||
// @Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
||||
// @RequiresDialectFeature( NonIdentityGeneratorChecker.class )
|
||||
public void testCollectionCUD() throws HibernateException, SQLException {
|
||||
Role role = new Role();
|
||||
|
|
|
@ -2476,7 +2476,6 @@ public class FooBarTest extends LegacyTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
||||
public void testPersistCollections() throws Exception {
|
||||
Session s = openSession();
|
||||
Transaction txn = s.beginTransaction();
|
||||
|
|
|
@ -50,7 +50,6 @@ public abstract class LegacyTestCase extends BaseCoreFunctionalTestCase {
|
|||
private boolean useAntlrParser;
|
||||
|
||||
@Before
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public void checkAntlrParserSetting() {
|
||||
useAntlrParser = Boolean.valueOf( extractFromSystem( USE_ANTLR_PARSER_PROP ) );
|
||||
}
|
||||
|
|
|
@ -64,7 +64,6 @@ import static org.junit.Assert.assertTrue;
|
|||
import static org.junit.Assert.fail;
|
||||
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public class ParentChildTest extends LegacyTestCase {
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
|
|
|
@ -57,7 +57,6 @@ import static org.junit.Assert.assertNotNull;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing", "UnnecessaryBoxing"})
|
||||
public class SQLFunctionsTest extends LegacyTestCase {
|
||||
private static final Logger log = Logger.getLogger( SQLFunctionsTest.class );
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ public class ManyToManyAssociationClassAssignedIdTest extends AbstractManyToMany
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public Membership createMembership(String name) {
|
||||
return new Membership( Long.valueOf( 1000 ), name );
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ public class MapIndexFormulaTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"unchecked", "UnnecessaryBoxing"})
|
||||
public void testIndexFormulaMap() {
|
||||
Session s = openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
|
|
|
@ -113,7 +113,6 @@ public class CreateTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCreateTreeWithGeneratedId() throws Exception {
|
||||
clearCounts();
|
||||
|
||||
|
|
|
@ -604,7 +604,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testMergeManaged() throws Exception {
|
||||
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
||||
|
@ -658,7 +657,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testMergeManagedUninitializedCollection() throws Exception {
|
||||
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
||||
|
@ -707,7 +705,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testMergeManagedInitializedCollection() throws Exception {
|
||||
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
||||
|
@ -781,7 +778,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing", "UnusedAssignment"})
|
||||
public void testDeleteAndMerge() throws Exception {
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
||||
Session s = openSession();
|
||||
|
|
|
@ -271,7 +271,6 @@ public class SaveOrUpdateTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testSaveOrUpdateManaged() throws Exception {
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
||||
Session s = openSession();
|
||||
|
@ -318,7 +317,6 @@ public class SaveOrUpdateTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testSaveOrUpdateGot() throws Exception {
|
||||
boolean instrumented = FieldInterceptionHelper.isInstrumented( new NumberedNode() );
|
||||
|
||||
|
@ -387,7 +385,6 @@ public class SaveOrUpdateTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment", "UnnecessaryBoxing"})
|
||||
public void testSaveOrUpdateGotWithMutableProp() throws Exception {
|
||||
clearCounts();
|
||||
|
||||
|
|
|
@ -155,7 +155,6 @@ public abstract class AbstractRecursiveBidirectionalOneToManyTest extends BaseCo
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
void check(boolean simplePropertyUpdated) {
|
||||
Session s = openSession();
|
||||
Transaction tx = s.beginTransaction();
|
||||
|
@ -181,7 +180,6 @@ public abstract class AbstractRecursiveBidirectionalOneToManyTest extends BaseCo
|
|||
s.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
void delete() {
|
||||
Session s = openSession();
|
||||
Transaction tx = s.beginTransaction();
|
||||
|
|
|
@ -39,7 +39,6 @@ public abstract class AbstractVersionedRecursiveBidirectionalOneToManyTest exten
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
void check(boolean simplePropertyUpdated) {
|
||||
super.check( simplePropertyUpdated );
|
||||
Session s = openSession();
|
||||
|
|
|
@ -102,7 +102,6 @@ public class CreateTest extends AbstractOperationTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testCreateTreeWithGeneratedId() {
|
||||
clearCounts();
|
||||
|
||||
|
|
|
@ -603,7 +603,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
cleanup();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
@Test
|
||||
public void testMergeManaged() {
|
||||
Session s = openSession();
|
||||
|
@ -646,7 +645,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
cleanup();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
@Test
|
||||
public void testMergeManagedUninitializedCollection() {
|
||||
Session s = openSession();
|
||||
|
@ -691,7 +689,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
cleanup();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
@Test
|
||||
public void testMergeManagedInitializedCollection() {
|
||||
Session s = openSession();
|
||||
|
@ -759,7 +756,6 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
cleanup();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
@Test
|
||||
public void testDeleteAndMerge() throws Exception {
|
||||
Session s = openSession();
|
||||
|
|
|
@ -132,7 +132,6 @@ public class OptimisticLockTest extends BaseCoreFunctionalTestCase {
|
|||
mainSession.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
private void testDeleteOptimisticLockFailure(String entityName) {
|
||||
Session mainSession = openSession();
|
||||
mainSession.beginTransaction();
|
||||
|
|
|
@ -81,7 +81,6 @@ public class GetHqlQueryPlanTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testHqlQueryPlanWithEnabledFilter() {
|
||||
Session s = openSession();
|
||||
QueryPlanCache cache = ( (SessionImplementor) s ).getFactory().getQueryPlanCache();
|
||||
|
|
|
@ -80,7 +80,6 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testUpdateFailureWithExceptionChecking() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -101,7 +100,6 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testUpdateFailureWithParamChecking() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -122,7 +120,6 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testDeleteWithExceptionChecking() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
@ -143,7 +140,6 @@ public abstract class ResultCheckStyleTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testDeleteWithParamChecking() {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
|
|
@ -47,7 +47,6 @@ import static org.junit.Assert.assertTrue;
|
|||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public abstract class CustomStoredProcTestSupport extends CustomSQLTestSupport {
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testScalarStoredProcedure() throws HibernateException, SQLException {
|
||||
Session s = openSession();
|
||||
Query namedQuery = s.getNamedQuery( "simpleScalar" );
|
||||
|
@ -60,7 +59,6 @@ public abstract class CustomStoredProcTestSupport extends CustomSQLTestSupport {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public void testParameterHandling() throws HibernateException, SQLException {
|
||||
Session s = openSession();
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ import static org.junit.Assert.fail;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
||||
public class NativeSQLQueriesTest extends BaseCoreFunctionalTestCase {
|
||||
public String[] getMappings() {
|
||||
return new String[] { "sql/hand/query/NativeSQLQueries.hbm.xml" };
|
||||
|
|
|
@ -86,7 +86,6 @@ import static org.junit.Assert.assertTrue;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public class TypeTest extends BaseUnitTestCase {
|
||||
private SessionImplementor session;
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ public class TypeParameterTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
||||
public void testSave() throws Exception {
|
||||
deleteData();
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.test.unionsubclass;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -45,6 +44,7 @@ import static org.junit.Assert.assertTrue;
|
|||
/**
|
||||
* @author Gavin King
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
|
@ -106,13 +106,13 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
.setFetchMode("location.beings", FetchMode.JOIN)
|
||||
.list();
|
||||
|
||||
for (int i=0; i<list.size(); i++ ) {
|
||||
Human h = (Human) list.get(i);
|
||||
for ( Object aList : list ) {
|
||||
Human h = (Human) aList;
|
||||
assertTrue( Hibernate.isInitialized( h.getLocation() ) );
|
||||
assertTrue( Hibernate.isInitialized( h.getLocation().getBeings() ) );
|
||||
s.delete(h);
|
||||
s.delete( h );
|
||||
}
|
||||
s.delete( s.get( Location.class, new Long(mel.getId()) ) );
|
||||
s.delete( s.get( Location.class, mel.getId() ) );
|
||||
t.commit();
|
||||
s.close();
|
||||
}
|
||||
|
@ -184,8 +184,8 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
x23y4 = (Alien) s.createCriteria(Alien.class).addOrder( Order.asc("identity") ).list().get(0);
|
||||
s.delete( x23y4.getHive() );
|
||||
s.delete( s.get(Location.class, new Long( mel.getId() ) ) );
|
||||
s.delete( s.get(Location.class, new Long( mars.getId() ) ) );
|
||||
s.delete( s.get(Location.class, mel.getId() ) );
|
||||
s.delete( s.get(Location.class, mars.getId() ) );
|
||||
assertTrue( s.createQuery("from Being").list().isEmpty() );
|
||||
t.commit();
|
||||
s.close();
|
||||
|
@ -260,7 +260,7 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
assertEquals( ( (Thing) gavin.getThings().get(0) ).getDescription(), "some thing" );
|
||||
s.clear();
|
||||
|
||||
thing = (Thing) s.get( Thing.class, new Long( thing.getId() ) );
|
||||
thing = (Thing) s.get( Thing.class, thing.getId() );
|
||||
assertFalse( Hibernate.isInitialized( thing.getOwner() ) );
|
||||
assertEquals( thing.getOwner().getIdentity(), "gavin" );
|
||||
|
||||
|
@ -272,15 +272,15 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
s.clear();
|
||||
|
||||
thing = (Thing) s.get( Thing.class, new Long( thing.getId() ) );
|
||||
thing = (Thing) s.get( Thing.class, thing.getId() );
|
||||
assertFalse( Hibernate.isInitialized( thing.getOwner() ) );
|
||||
assertEquals( thing.getOwner().getIdentity(), "x23y4$$hu%3" );
|
||||
|
||||
s.delete(thing);
|
||||
x23y4 = (Alien) s.createCriteria(Alien.class).uniqueResult();
|
||||
s.delete( x23y4.getHive() );
|
||||
s.delete( s.get(Location.class, new Long( mel.getId() ) ) );
|
||||
s.delete( s.get(Location.class, new Long( mars.getId() ) ) );
|
||||
s.delete( s.get(Location.class, mel.getId() ) );
|
||||
s.delete( s.get(Location.class, mars.getId() ) );
|
||||
assertTrue( s.createQuery("from Being").list().isEmpty() );
|
||||
t.commit();
|
||||
s.close();
|
||||
|
@ -323,8 +323,8 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
s.clear();
|
||||
|
||||
List beings = s.createQuery("from Being b left join fetch b.location").list();
|
||||
for ( Iterator iter = beings.iterator(); iter.hasNext(); ) {
|
||||
Being b = (Being) iter.next();
|
||||
for ( Object being : beings ) {
|
||||
Being b = (Being) being;
|
||||
assertTrue( Hibernate.isInitialized( b.getLocation() ) );
|
||||
assertNotNull( b.getLocation().getName() );
|
||||
assertNotNull( b.getIdentity() );
|
||||
|
@ -334,8 +334,8 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
s.clear();
|
||||
|
||||
beings = s.createQuery("from Being").list();
|
||||
for ( Iterator iter = beings.iterator(); iter.hasNext(); ) {
|
||||
Being b = (Being) iter.next();
|
||||
for ( Object being : beings ) {
|
||||
Being b = (Being) being;
|
||||
assertFalse( Hibernate.isInitialized( b.getLocation() ) );
|
||||
assertNotNull( b.getLocation().getName() );
|
||||
assertNotNull( b.getIdentity() );
|
||||
|
@ -346,13 +346,12 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
List locations = s.createQuery("from Location").list();
|
||||
int count = 0;
|
||||
for ( Iterator iter = locations.iterator(); iter.hasNext(); ) {
|
||||
Location l = (Location) iter.next();
|
||||
for ( Object location : locations ) {
|
||||
Location l = (Location) location;
|
||||
assertNotNull( l.getName() );
|
||||
Iterator iter2 = l.getBeings().iterator();
|
||||
while ( iter2.hasNext() ) {
|
||||
for ( Object o : l.getBeings() ) {
|
||||
count++;
|
||||
assertSame( ( (Being) iter2.next() ).getLocation(), l );
|
||||
assertSame( ( (Being) o ).getLocation(), l );
|
||||
}
|
||||
}
|
||||
assertEquals(count, 2);
|
||||
|
@ -361,21 +360,20 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
locations = s.createQuery("from Location loc left join fetch loc.beings").list();
|
||||
count = 0;
|
||||
for ( Iterator iter = locations.iterator(); iter.hasNext(); ) {
|
||||
Location l = (Location) iter.next();
|
||||
for ( Object location : locations ) {
|
||||
Location l = (Location) location;
|
||||
assertNotNull( l.getName() );
|
||||
Iterator iter2 = l.getBeings().iterator();
|
||||
while ( iter2.hasNext() ) {
|
||||
for ( Object o : l.getBeings() ) {
|
||||
count++;
|
||||
assertSame( ( (Being) iter2.next() ).getLocation(), l );
|
||||
assertSame( ( (Being) o ).getLocation(), l );
|
||||
}
|
||||
}
|
||||
assertEquals(count, 2);
|
||||
assertEquals( locations.size(), 3 );
|
||||
s.clear();
|
||||
|
||||
gavin = (Human) s.get( Human.class, new Long( gavin.getId() ) );
|
||||
atl = (Location) s.get( Location.class, new Long( atl.getId() ) );
|
||||
gavin = (Human) s.get( Human.class, gavin.getId() );
|
||||
atl = (Location) s.get( Location.class, atl.getId() );
|
||||
|
||||
atl.addBeing(gavin);
|
||||
assertEquals( s.createQuery("from Human h where h.location.name like '%GA'").list().size(), 1 );
|
||||
|
@ -403,7 +401,7 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
|||
Employee steve = new Employee();
|
||||
steve.setIdentity("steve");
|
||||
steve.setSex('M');
|
||||
steve.setSalary( new Double(0) );
|
||||
steve.setSalary( (double) 0 );
|
||||
mel.addBeing(steve);
|
||||
s.persist(mel);
|
||||
tx.commit();
|
||||
|
|
|
@ -76,7 +76,6 @@ public class SellCarTest extends BaseCoreFunctionalTestCase {
|
|||
return stliu;
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
private PersonID createID( String name ) {
|
||||
PersonID id = new PersonID();
|
||||
id.setName( name );
|
||||
|
|
|
@ -44,7 +44,6 @@ import static org.junit.Assert.assertTrue;
|
|||
/**
|
||||
* @author Gavin King
|
||||
*/
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
|
||||
protected String[] getMappings() {
|
||||
return new String[] { "unionsubclass2/Person.hbm.xml" };
|
||||
|
|
Loading…
Reference in New Issue