mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 16:44:57 +00:00
merge master branch
This commit is contained in:
commit
cc6d271f31
@ -196,8 +196,8 @@ public void configure(Map props) {
|
|||||||
// revert to traditional hibernate behavior of setting initialPoolSize to minPoolSize
|
// revert to traditional hibernate behavior of setting initialPoolSize to minPoolSize
|
||||||
// unless otherwise specified with a c3p0.*-style parameter.
|
// unless otherwise specified with a c3p0.*-style parameter.
|
||||||
final Integer initialPoolSize = ConfigurationHelper.getInteger( C3P0_STYLE_INITIAL_POOL_SIZE, props );
|
final Integer initialPoolSize = ConfigurationHelper.getInteger( C3P0_STYLE_INITIAL_POOL_SIZE, props );
|
||||||
if ( initialPoolSize == null && minPoolSize != null ) {
|
if ( initialPoolSize == null ) {
|
||||||
c3props.put( C3P0_STYLE_INITIAL_POOL_SIZE, String.valueOf( minPoolSize ).trim() );
|
setOverwriteProperty( "", C3P0_STYLE_INITIAL_POOL_SIZE, props, c3props, minPoolSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
final DataSource unpooled = DataSources.unpooledDataSource( jdbcUrl, connectionProps );
|
final DataSource unpooled = DataSources.unpooledDataSource( jdbcUrl, connectionProps );
|
||||||
|
@ -65,6 +65,9 @@ public void testHHH6635() throws Exception {
|
|||||||
int actual_minPoolSize = (Integer) mBeanServer.getAttribute( obj, "minPoolSize" );
|
int actual_minPoolSize = (Integer) mBeanServer.getAttribute( obj, "minPoolSize" );
|
||||||
assertEquals( 50, actual_minPoolSize );
|
assertEquals( 50, actual_minPoolSize );
|
||||||
|
|
||||||
|
int actual_initialPoolSize = (Integer) mBeanServer.getAttribute( obj, "initialPoolSize" );
|
||||||
|
assertEquals( 50, actual_initialPoolSize );
|
||||||
|
|
||||||
int actual_maxPoolSize = (Integer) mBeanServer.getAttribute( obj, "maxPoolSize" );
|
int actual_maxPoolSize = (Integer) mBeanServer.getAttribute( obj, "maxPoolSize" );
|
||||||
assertEquals( 800, actual_maxPoolSize );
|
assertEquals( 800, actual_maxPoolSize );
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ jar {
|
|||||||
manifest {
|
manifest {
|
||||||
instruction 'Bundle-Description', 'Hibernate ORM Core'
|
instruction 'Bundle-Description', 'Hibernate ORM Core'
|
||||||
|
|
||||||
instruction 'Import-Package',
|
instructionFirst 'Import-Package',
|
||||||
'javax.security.auth;resolution:=optional',
|
'javax.security.auth;resolution:=optional',
|
||||||
'javax.security.jacc;resolution:=optional',
|
'javax.security.jacc;resolution:=optional',
|
||||||
'javax.validation;resolution:=optional',
|
'javax.validation;resolution:=optional',
|
||||||
|
@ -78,7 +78,7 @@ public ClassLoaderServiceImpl(ClassLoader classLoader) {
|
|||||||
public ClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders) {
|
public ClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders) {
|
||||||
final LinkedHashSet<ClassLoader> orderedClassLoaderSet = new LinkedHashSet<ClassLoader>();
|
final LinkedHashSet<ClassLoader> orderedClassLoaderSet = new LinkedHashSet<ClassLoader>();
|
||||||
|
|
||||||
// first add all provided class loaders, if any
|
// first, add all provided class loaders, if any
|
||||||
if ( providedClassLoaders != null ) {
|
if ( providedClassLoaders != null ) {
|
||||||
for ( ClassLoader classLoader : providedClassLoaders ) {
|
for ( ClassLoader classLoader : providedClassLoaders ) {
|
||||||
if ( classLoader != null ) {
|
if ( classLoader != null ) {
|
||||||
@ -88,8 +88,9 @@ public ClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// normalize adding known class-loaders...
|
// normalize adding known class-loaders...
|
||||||
// first, the Hibernate class loader
|
// then the Hibernate class loader
|
||||||
orderedClassLoaderSet.add( ClassLoaderServiceImpl.class.getClassLoader() );
|
orderedClassLoaderSet.add( ClassLoaderServiceImpl.class.getClassLoader() );
|
||||||
|
|
||||||
// then the TCCL, if one...
|
// then the TCCL, if one...
|
||||||
final ClassLoader tccl = locateTCCL();
|
final ClassLoader tccl = locateTCCL();
|
||||||
if ( tccl != null ) {
|
if ( tccl != null ) {
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing", "UnnecessaryBoxing"})
|
|
||||||
final class FieldInterceptorImpl extends AbstractFieldInterceptor implements FieldHandler, Serializable {
|
final class FieldInterceptorImpl extends AbstractFieldInterceptor implements FieldHandler, Serializable {
|
||||||
|
|
||||||
FieldInterceptorImpl(SessionImplementor session, Set uninitializedFields, String entityName) {
|
FieldInterceptorImpl(SessionImplementor session, Set uninitializedFields, String entityName) {
|
||||||
@ -55,39 +54,39 @@ final class FieldInterceptorImpl extends AbstractFieldInterceptor implements Fie
|
|||||||
|
|
||||||
|
|
||||||
// FieldHandler impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// FieldHandler impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@Override
|
||||||
public boolean readBoolean(Object target, String name, boolean oldValue) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
public Object readObject(Object target, String name, Object oldValue) {
|
||||||
Object value = intercept( target, name, oldValue );
|
Object value = intercept( target, name, oldValue );
|
||||||
if ( value instanceof HibernateProxy ) {
|
if ( value instanceof HibernateProxy ) {
|
||||||
@ -98,61 +97,61 @@ public Object readObject(Object target, String name, Object oldValue) {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean writeBoolean(Object target, String name, boolean oldValue, boolean newValue) {
|
public boolean writeBoolean(Object target, String name, boolean oldValue, boolean newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, oldValue );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public byte writeByte(Object target, String name, byte oldValue, byte newValue) {
|
public byte writeByte(Object target, String name, byte oldValue, byte newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, Byte.valueOf( oldValue ) );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public char writeChar(Object target, String name, char oldValue, char newValue) {
|
public char writeChar(Object target, String name, char oldValue, char newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, Character.valueOf( oldValue ) );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public double writeDouble(Object target, String name, double oldValue, double newValue) {
|
public double writeDouble(Object target, String name, double oldValue, double newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, Double.valueOf( oldValue ) );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public float writeFloat(Object target, String name, float oldValue, float newValue) {
|
public float writeFloat(Object target, String name, float oldValue, float newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, Float.valueOf( oldValue ) );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public int writeInt(Object target, String name, int oldValue, int newValue) {
|
public int writeInt(Object target, String name, int oldValue, int newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, Integer.valueOf( oldValue ) );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long writeLong(Object target, String name, long oldValue, long newValue) {
|
public long writeLong(Object target, String name, long oldValue, long newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, Long.valueOf( oldValue ) );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public short writeShort(Object target, String name, short oldValue, short newValue) {
|
public short writeShort(Object target, String name, short oldValue, short newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, Short.valueOf( oldValue ) );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Object writeObject(Object target, String name, Object oldValue, Object newValue) {
|
public Object writeObject(Object target, String name, Object oldValue, Object newValue) {
|
||||||
dirty();
|
dirty();
|
||||||
intercept( target, name, oldValue );
|
intercept( target, name, oldValue );
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FieldInterceptorImpl(entityName=" + getEntityName() +
|
return "FieldInterceptorImpl(entityName=" + getEntityName() +
|
||||||
",dirty=" + isDirty() +
|
",dirty=" + isDirty() +
|
||||||
|
@ -158,7 +158,7 @@ public List get(
|
|||||||
final QueryKey key,
|
final QueryKey key,
|
||||||
final Type[] returnTypes,
|
final Type[] returnTypes,
|
||||||
final boolean isNaturalKeyLookup,
|
final boolean isNaturalKeyLookup,
|
||||||
final Set spaces,
|
final Set<Serializable> spaces,
|
||||||
final SessionImplementor session) throws HibernateException {
|
final SessionImplementor session) throws HibernateException {
|
||||||
if ( DEBUGGING ) {
|
if ( DEBUGGING ) {
|
||||||
LOG.debugf( "Checking cached query results in region: %s", cacheRegion.getName() );
|
LOG.debugf( "Checking cached query results in region: %s", cacheRegion.getName() );
|
||||||
@ -228,7 +228,7 @@ public List get(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isUpToDate(final Set spaces, final Long timestamp) {
|
protected boolean isUpToDate(final Set<Serializable> spaces, final Long timestamp) {
|
||||||
if ( DEBUGGING ) {
|
if ( DEBUGGING ) {
|
||||||
LOG.debugf( "Checking query spaces are up-to-date: %s", spaces );
|
LOG.debugf( "Checking query spaces are up-to-date: %s", spaces );
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.cache.spi;
|
package org.hibernate.cache.spi;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ public interface QueryCache {
|
|||||||
*
|
*
|
||||||
* @throws HibernateException Indicates a problem delegating to the underlying cache.
|
* @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.
|
* Destroy the cache.
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
*/
|
*/
|
||||||
public class UpdateTimestampsCache {
|
public class UpdateTimestampsCache {
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, UpdateTimestampsCache.class.getName() );
|
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.
|
* The region name of the update-timestamps cache.
|
||||||
*/
|
*/
|
||||||
@ -90,15 +90,13 @@ public UpdateTimestampsCache(Settings settings, Properties props) {
|
|||||||
*
|
*
|
||||||
* @throws CacheException Indicated problem delegating to underlying region.
|
* @throws CacheException Indicated problem delegating to underlying region.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"UnnecessaryBoxing"})
|
|
||||||
public void preinvalidate(Serializable[] spaces) throws CacheException {
|
public void preinvalidate(Serializable[] spaces) throws CacheException {
|
||||||
final boolean debug = LOG.isDebugEnabled();
|
|
||||||
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
||||||
|
|
||||||
final Long ts = region.nextTimestamp() + region.getTimeout();
|
final Long ts = region.nextTimestamp() + region.getTimeout();
|
||||||
|
|
||||||
for ( Serializable space : spaces ) {
|
for ( Serializable space : spaces ) {
|
||||||
if ( debug ) {
|
if ( DEBUG_ENABLED ) {
|
||||||
LOG.debugf( "Pre-invalidating space [%s], timestamp: %s", space, ts );
|
LOG.debugf( "Pre-invalidating space [%s], timestamp: %s", space, ts );
|
||||||
}
|
}
|
||||||
//put() has nowait semantics, is this really appropriate?
|
//put() has nowait semantics, is this really appropriate?
|
||||||
@ -117,15 +115,13 @@ public void preinvalidate(Serializable[] spaces) throws CacheException {
|
|||||||
*
|
*
|
||||||
* @throws CacheException Indicated problem delegating to underlying region.
|
* @throws CacheException Indicated problem delegating to underlying region.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"UnnecessaryBoxing"})
|
|
||||||
public void invalidate(Serializable[] spaces) throws CacheException {
|
public void invalidate(Serializable[] spaces) throws CacheException {
|
||||||
final boolean debug = LOG.isDebugEnabled();
|
|
||||||
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
||||||
|
|
||||||
final Long ts = region.nextTimestamp();
|
final Long ts = region.nextTimestamp();
|
||||||
|
|
||||||
for (Serializable space : spaces) {
|
for (Serializable space : spaces) {
|
||||||
if ( debug ) {
|
if ( DEBUG_ENABLED ) {
|
||||||
LOG.debugf( "Invalidating space [%s], timestamp: %s", space, ts );
|
LOG.debugf( "Invalidating space [%s], timestamp: %s", space, ts );
|
||||||
}
|
}
|
||||||
//put() has nowait semantics, is this really appropriate?
|
//put() has nowait semantics, is this really appropriate?
|
||||||
@ -147,12 +143,10 @@ public void invalidate(Serializable[] spaces) throws CacheException {
|
|||||||
*
|
*
|
||||||
* @throws CacheException Indicated problem delegating to underlying region.
|
* @throws CacheException Indicated problem delegating to underlying region.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
public boolean isUpToDate(Set<Serializable> spaces, Long timestamp) throws CacheException {
|
||||||
public boolean isUpToDate(Set spaces, Long timestamp) throws CacheException {
|
|
||||||
final boolean debug = LOG.isDebugEnabled();
|
|
||||||
final boolean stats = factory != null && factory.getStatistics().isStatisticsEnabled();
|
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 );
|
final Long lastUpdate = (Long) region.get( space );
|
||||||
if ( lastUpdate == null ) {
|
if ( lastUpdate == null ) {
|
||||||
if ( stats ) {
|
if ( stats ) {
|
||||||
@ -164,7 +158,7 @@ public boolean isUpToDate(Set spaces, Long timestamp) throws CacheException {
|
|||||||
//result = false; // safer
|
//result = false; // safer
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( debug ) {
|
if ( DEBUG_ENABLED ) {
|
||||||
LOG.debugf(
|
LOG.debugf(
|
||||||
"[%s] last update timestamp: %s",
|
"[%s] last update timestamp: %s",
|
||||||
space,
|
space,
|
||||||
|
@ -84,7 +84,6 @@
|
|||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
||||||
import org.hibernate.cache.spi.GeneralDataRegion;
|
|
||||||
import org.hibernate.cfg.annotations.NamedEntityGraphDefinition;
|
import org.hibernate.cfg.annotations.NamedEntityGraphDefinition;
|
||||||
import org.hibernate.cfg.annotations.NamedProcedureCallDefinition;
|
import org.hibernate.cfg.annotations.NamedProcedureCallDefinition;
|
||||||
import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
|
import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
|
||||||
@ -876,6 +875,7 @@ public Configuration addJar(File jar) throws MappingException {
|
|||||||
*/
|
*/
|
||||||
public Configuration addDirectory(File dir) throws MappingException {
|
public Configuration addDirectory(File dir) throws MappingException {
|
||||||
File[] files = dir.listFiles();
|
File[] files = dir.listFiles();
|
||||||
|
if ( files != null ) {
|
||||||
for ( File file : files ) {
|
for ( File file : files ) {
|
||||||
if ( file.isDirectory() ) {
|
if ( file.isDirectory() ) {
|
||||||
addDirectory( file );
|
addDirectory( file );
|
||||||
@ -884,6 +884,7 @@ else if ( file.getName().endsWith( ".hbm.xml" ) ) {
|
|||||||
addFile( file );
|
addFile( file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1527,10 +1528,8 @@ private void buildRecursiveOrderedFkSecondPasses(
|
|||||||
for ( FkSecondPass sp : dependencies ) {
|
for ( FkSecondPass sp : dependencies ) {
|
||||||
String dependentTable = quotedTableName(sp.getValue().getTable());
|
String dependentTable = quotedTableName(sp.getValue().getTable());
|
||||||
if ( dependentTable.compareTo( startTable ) == 0 ) {
|
if ( dependentTable.compareTo( startTable ) == 0 ) {
|
||||||
StringBuilder sb = new StringBuilder(
|
String sb = "Foreign key circularity dependency involving the following tables: ";
|
||||||
"Foreign key circularity dependency involving the following tables: "
|
throw new AnnotationException( sb );
|
||||||
);
|
|
||||||
throw new AnnotationException( sb.toString() );
|
|
||||||
}
|
}
|
||||||
buildRecursiveOrderedFkSecondPasses( orderedFkSecondPasses, isADependencyOf, startTable, dependentTable );
|
buildRecursiveOrderedFkSecondPasses( orderedFkSecondPasses, isADependencyOf, startTable, dependentTable );
|
||||||
if ( !orderedFkSecondPasses.contains( sp ) ) {
|
if ( !orderedFkSecondPasses.contains( sp ) ) {
|
||||||
@ -3151,7 +3150,7 @@ public String getPhysicalColumnName(String logicalName, Table table) throws Mapp
|
|||||||
}
|
}
|
||||||
return finalName;
|
return finalName;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getLogicalColumnName(String physicalName, Table table) throws MappingException {
|
public String getLogicalColumnName(String physicalName, Table table) throws MappingException {
|
||||||
String logical = null;
|
String logical = null;
|
||||||
Table currentTable = table;
|
Table currentTable = table;
|
||||||
@ -3172,7 +3171,7 @@ public String getLogicalColumnName(String physicalName, Table table) throws Mapp
|
|||||||
currentTable = null;
|
currentTable = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( logical == null && currentTable != null && description != null );
|
while ( logical == null && currentTable != null );
|
||||||
if ( logical == null ) {
|
if ( logical == null ) {
|
||||||
throw new MappingException(
|
throw new MappingException(
|
||||||
"Unable to find logical column name from physical name "
|
"Unable to find logical column name from physical name "
|
||||||
@ -3294,41 +3293,38 @@ public void addToOneAndIdProperty(XClass entityType, PropertyData property) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Boolean useNewGeneratorMappings;
|
private Boolean useNewGeneratorMappings;
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public boolean useNewGeneratorMappings() {
|
public boolean useNewGeneratorMappings() {
|
||||||
if ( useNewGeneratorMappings == null ) {
|
if ( useNewGeneratorMappings == null ) {
|
||||||
final String booleanName = getConfigurationProperties()
|
final String booleanName = getConfigurationProperties()
|
||||||
.getProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS );
|
.getProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS );
|
||||||
useNewGeneratorMappings = Boolean.valueOf( booleanName );
|
useNewGeneratorMappings = Boolean.valueOf( booleanName );
|
||||||
}
|
}
|
||||||
return useNewGeneratorMappings.booleanValue();
|
return useNewGeneratorMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean useNationalizedCharacterData;
|
private Boolean useNationalizedCharacterData;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
public boolean useNationalizedCharacterData() {
|
public boolean useNationalizedCharacterData() {
|
||||||
if ( useNationalizedCharacterData == null ) {
|
if ( useNationalizedCharacterData == null ) {
|
||||||
final String booleanName = getConfigurationProperties()
|
final String booleanName = getConfigurationProperties()
|
||||||
.getProperty( AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA );
|
.getProperty( AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA );
|
||||||
useNationalizedCharacterData = Boolean.valueOf( booleanName );
|
useNationalizedCharacterData = Boolean.valueOf( booleanName );
|
||||||
}
|
}
|
||||||
return useNationalizedCharacterData.booleanValue();
|
return useNationalizedCharacterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean forceDiscriminatorInSelectsByDefault;
|
private Boolean forceDiscriminatorInSelectsByDefault;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
public boolean forceDiscriminatorInSelectsByDefault() {
|
public boolean forceDiscriminatorInSelectsByDefault() {
|
||||||
if ( forceDiscriminatorInSelectsByDefault == null ) {
|
if ( forceDiscriminatorInSelectsByDefault == null ) {
|
||||||
final String booleanName = getConfigurationProperties()
|
final String booleanName = getConfigurationProperties()
|
||||||
.getProperty( AvailableSettings.FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT );
|
.getProperty( AvailableSettings.FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT );
|
||||||
forceDiscriminatorInSelectsByDefault = Boolean.valueOf( booleanName );
|
forceDiscriminatorInSelectsByDefault = Boolean.valueOf( booleanName );
|
||||||
}
|
}
|
||||||
return forceDiscriminatorInSelectsByDefault.booleanValue();
|
return forceDiscriminatorInSelectsByDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IdGenerator getGenerator(String name) {
|
public IdGenerator getGenerator(String name) {
|
||||||
@ -3520,7 +3516,7 @@ public boolean isUseQuotedIdentifiersGlobally() {
|
|||||||
//Do not cache this value as we lazily set it in Hibernate Annotation (AnnotationConfiguration)
|
//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)
|
//TODO use a dedicated protected useQuotedIdentifier flag in Configuration (overriden by AnnotationConfiguration)
|
||||||
String setting = (String) properties.get( Environment.GLOBALLY_QUOTED_IDENTIFIERS );
|
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() {
|
public NamingStrategy getNamingStrategy() {
|
||||||
|
@ -132,8 +132,10 @@
|
|||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import org.hibernate.AnnotationException;
|
import org.hibernate.AnnotationException;
|
||||||
|
import org.hibernate.annotations.Any;
|
||||||
import org.hibernate.annotations.Cascade;
|
import org.hibernate.annotations.Cascade;
|
||||||
import org.hibernate.annotations.Columns;
|
import org.hibernate.annotations.Columns;
|
||||||
|
import org.hibernate.annotations.ManyToAny;
|
||||||
import org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor;
|
import org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor;
|
||||||
import org.hibernate.annotations.common.annotationfactory.AnnotationFactory;
|
import org.hibernate.annotations.common.annotationfactory.AnnotationFactory;
|
||||||
import org.hibernate.annotations.common.reflection.AnnotationReader;
|
import org.hibernate.annotations.common.reflection.AnnotationReader;
|
||||||
@ -219,6 +221,8 @@ public boolean returnTransient() {
|
|||||||
annotationToXml.put( OneToOne.class, "one-to-one" );
|
annotationToXml.put( OneToOne.class, "one-to-one" );
|
||||||
annotationToXml.put( OneToMany.class, "one-to-many" );
|
annotationToXml.put( OneToMany.class, "one-to-many" );
|
||||||
annotationToXml.put( ManyToMany.class, "many-to-many" );
|
annotationToXml.put( ManyToMany.class, "many-to-many" );
|
||||||
|
annotationToXml.put( Any.class, "any" );
|
||||||
|
annotationToXml.put( ManyToAny.class, "many-to-any" );
|
||||||
annotationToXml.put( JoinTable.class, "join-table" );
|
annotationToXml.put( JoinTable.class, "join-table" );
|
||||||
annotationToXml.put( JoinColumn.class, "join-column" );
|
annotationToXml.put( JoinColumn.class, "join-column" );
|
||||||
annotationToXml.put( JoinColumns.class, "join-column" );
|
annotationToXml.put( JoinColumns.class, "join-column" );
|
||||||
@ -414,6 +418,8 @@ else if ( className != null ) { //&& propertyName != null ) { //always true but
|
|||||||
getAssociation( OneToOne.class, annotationList, defaults );
|
getAssociation( OneToOne.class, annotationList, defaults );
|
||||||
getAssociation( OneToMany.class, annotationList, defaults );
|
getAssociation( OneToMany.class, annotationList, defaults );
|
||||||
getAssociation( ManyToMany.class, annotationList, defaults );
|
getAssociation( ManyToMany.class, annotationList, defaults );
|
||||||
|
getAssociation( Any.class, annotationList, defaults );
|
||||||
|
getAssociation( ManyToAny.class, annotationList, defaults );
|
||||||
getElementCollection( annotationList, defaults );
|
getElementCollection( annotationList, defaults );
|
||||||
addIfNotNull( annotationList, getSequenceGenerator( elementsForProperty, defaults ) );
|
addIfNotNull( annotationList, getSequenceGenerator( elementsForProperty, defaults ) );
|
||||||
addIfNotNull( annotationList, getTableGenerator( elementsForProperty, defaults ) );
|
addIfNotNull( annotationList, getTableGenerator( elementsForProperty, defaults ) );
|
||||||
|
@ -284,10 +284,9 @@ public boolean isEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public boolean contains(Object object) {
|
public boolean contains(Object object) {
|
||||||
final Boolean exists = readElementExistence( object );
|
final Boolean exists = readElementExistence( object );
|
||||||
return exists == null ? bag.contains( object ) : exists.booleanValue();
|
return exists == null ? bag.contains( object ) : exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -136,12 +136,11 @@ public boolean isEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public boolean contains(Object object) {
|
public boolean contains(Object object) {
|
||||||
final Boolean exists = readElementExistence( object );
|
final Boolean exists = readElementExistence( object );
|
||||||
return exists == null
|
return exists == null
|
||||||
? list.contains( object )
|
? list.contains( object )
|
||||||
: exists.booleanValue();
|
: exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -176,7 +175,6 @@ public boolean add(Object object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public boolean remove(Object value) {
|
public boolean remove(Object value) {
|
||||||
final Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
|
final Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
|
||||||
if ( exists == null ) {
|
if ( exists == null ) {
|
||||||
@ -189,7 +187,7 @@ public boolean remove(Object value) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( exists.booleanValue() ) {
|
else if ( exists ) {
|
||||||
queueOperation( new SimpleRemove( value ) );
|
queueOperation( new SimpleRemove( value ) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -146,19 +146,17 @@ public boolean isEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public boolean containsKey(Object key) {
|
public boolean containsKey(Object key) {
|
||||||
final Boolean exists = readIndexExistence( key );
|
final Boolean exists = readIndexExistence( key );
|
||||||
return exists == null ? map.containsKey( key ) : exists.booleanValue();
|
return exists == null ? map.containsKey( key ) : exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public boolean containsValue(Object value) {
|
public boolean containsValue(Object value) {
|
||||||
final Boolean exists = readElementExistence( value );
|
final Boolean exists = readElementExistence( value );
|
||||||
return exists == null
|
return exists == null
|
||||||
? map.containsValue( value )
|
? map.containsValue( value )
|
||||||
: exists.booleanValue();
|
: exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -167,12 +167,11 @@ public boolean isEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
|
||||||
public boolean contains(Object object) {
|
public boolean contains(Object object) {
|
||||||
final Boolean exists = readElementExistence( object );
|
final Boolean exists = readElementExistence( object );
|
||||||
return exists == null
|
return exists == null
|
||||||
? set.contains( object )
|
? set.contains( object )
|
||||||
: exists.booleanValue();
|
: exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -197,7 +196,6 @@ public Object[] toArray(Object[] array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
|
||||||
public boolean add(Object value) {
|
public boolean add(Object value) {
|
||||||
final Boolean exists = isOperationQueueEnabled() ? readElementExistence( value ) : null;
|
final Boolean exists = isOperationQueueEnabled() ? readElementExistence( value ) : null;
|
||||||
if ( exists == null ) {
|
if ( exists == null ) {
|
||||||
@ -210,7 +208,7 @@ public boolean add(Object value) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( exists.booleanValue() ) {
|
else if ( exists ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -220,7 +218,6 @@ else if ( exists.booleanValue() ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "UnnecessaryUnboxing"})
|
|
||||||
public boolean remove(Object value) {
|
public boolean remove(Object value) {
|
||||||
final Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
|
final Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
|
||||||
if ( exists == null ) {
|
if ( exists == null ) {
|
||||||
@ -233,7 +230,7 @@ public boolean remove(Object value) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( exists.booleanValue() ) {
|
else if ( exists ) {
|
||||||
queueOperation( new SimpleRemove( value ) );
|
queueOperation( new SimpleRemove( value ) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,6 @@ public DerbyDialect() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"UnnecessaryUnboxing", "unchecked"})
|
|
||||||
private void determineDriverVersion() {
|
private void determineDriverVersion() {
|
||||||
try {
|
try {
|
||||||
// locate the derby sysinfo class and query its version info
|
// locate the derby sysinfo class and query its version info
|
||||||
|
@ -61,6 +61,7 @@ public MySQLDialect() {
|
|||||||
registerColumnType( Types.CHAR, "char(1)" );
|
registerColumnType( Types.CHAR, "char(1)" );
|
||||||
registerColumnType( Types.FLOAT, "float" );
|
registerColumnType( Types.FLOAT, "float" );
|
||||||
registerColumnType( Types.DOUBLE, "double precision" );
|
registerColumnType( Types.DOUBLE, "double precision" );
|
||||||
|
registerColumnType( Types.BOOLEAN, "bit" ); // HHH-6935
|
||||||
registerColumnType( Types.DATE, "date" );
|
registerColumnType( Types.DATE, "date" );
|
||||||
registerColumnType( Types.TIME, "time" );
|
registerColumnType( Types.TIME, "time" );
|
||||||
registerColumnType( Types.TIMESTAMP, "datetime" );
|
registerColumnType( Types.TIMESTAMP, "datetime" );
|
||||||
|
@ -50,7 +50,6 @@ public class TemplateRenderer {
|
|||||||
*
|
*
|
||||||
* @param template The template
|
* @param template The template
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public TemplateRenderer(String template) {
|
public TemplateRenderer(String template) {
|
||||||
this.template = template;
|
this.template = template;
|
||||||
|
|
||||||
|
@ -225,7 +225,6 @@ public static boolean isNotTransient(String entityName, Object entity, Boolean a
|
|||||||
*
|
*
|
||||||
* @return {@code true} if the given entity is transient (unsaved)
|
* @return {@code true} if the given entity is transient (unsaved)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public static boolean isTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session) {
|
public static boolean isTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session) {
|
||||||
if ( entity == LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
|
if ( entity == LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
|
||||||
// an unfetched association can only point to
|
// an unfetched association can only point to
|
||||||
@ -236,20 +235,20 @@ public static boolean isTransient(String entityName, Object entity, Boolean assu
|
|||||||
// let the interceptor inspect the instance to decide
|
// let the interceptor inspect the instance to decide
|
||||||
Boolean isUnsaved = session.getInterceptor().isTransient( entity );
|
Boolean isUnsaved = session.getInterceptor().isTransient( entity );
|
||||||
if ( isUnsaved != null ) {
|
if ( isUnsaved != null ) {
|
||||||
return isUnsaved.booleanValue();
|
return isUnsaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let the persister inspect the instance to decide
|
// let the persister inspect the instance to decide
|
||||||
final EntityPersister persister = session.getEntityPersister( entityName, entity );
|
final EntityPersister persister = session.getEntityPersister( entityName, entity );
|
||||||
isUnsaved = persister.isTransient( entity, session );
|
isUnsaved = persister.isTransient( entity, session );
|
||||||
if ( isUnsaved != null ) {
|
if ( isUnsaved != null ) {
|
||||||
return isUnsaved.booleanValue();
|
return isUnsaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we use the assumed value, if there is one, to avoid hitting
|
// we use the assumed value, if there is one, to avoid hitting
|
||||||
// the database
|
// the database
|
||||||
if ( assumed != null ) {
|
if ( assumed != null ) {
|
||||||
return assumed.booleanValue();
|
return assumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hit the database, after checking the session cache for a snapshot
|
// hit the database, after checking the session cache for a snapshot
|
||||||
|
@ -75,37 +75,44 @@ private long getLength() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private InputStream getStream() throws SQLException {
|
private InputStream getStream() throws SQLException {
|
||||||
final InputStream stream = binaryStream.getInputStream();
|
return getUnderlyingStream().getInputStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
private BinaryStream getUnderlyingStream() throws SQLException {
|
||||||
|
resetIfNeeded();
|
||||||
|
return binaryStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetIfNeeded() throws SQLException {
|
||||||
try {
|
try {
|
||||||
if ( needsReset ) {
|
if ( needsReset ) {
|
||||||
stream.reset();
|
binaryStream.getInputStream().reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( IOException ioe) {
|
catch ( IOException ioe) {
|
||||||
throw new SQLException("could not reset reader");
|
throw new SQLException("could not reset reader");
|
||||||
}
|
}
|
||||||
needsReset = true;
|
needsReset = true;
|
||||||
return stream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
* @throws UnsupportedOperationException if any methods other than
|
* @throws UnsupportedOperationException if any methods other than
|
||||||
* {@link Blob#length}, {@link Blob#getBinaryStream}, {@link Blob#getBytes}, {@link Blob#free},
|
* {@link Blob#length}, {@link BlobImplementer#getUnderlyingStream},
|
||||||
|
* {@link Blob#getBinaryStream}, {@link Blob#getBytes}, {@link Blob#free},
|
||||||
* or toString/equals/hashCode are invoked.
|
* or toString/equals/hashCode are invoked.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
final String methodName = method.getName();
|
final String methodName = method.getName();
|
||||||
final int argCount = method.getParameterTypes().length;
|
final int argCount = method.getParameterTypes().length;
|
||||||
|
|
||||||
if ( "length".equals( methodName ) && argCount == 0 ) {
|
if ( "length".equals( methodName ) && argCount == 0 ) {
|
||||||
return Long.valueOf( getLength() );
|
return getLength();
|
||||||
}
|
}
|
||||||
if ( "getUnderlyingStream".equals( methodName ) ) {
|
if ( "getUnderlyingStream".equals( methodName ) ) {
|
||||||
return binaryStream;
|
return getUnderlyingStream(); // Reset stream if needed.
|
||||||
}
|
}
|
||||||
if ( "getBinaryStream".equals( methodName ) ) {
|
if ( "getBinaryStream".equals( methodName ) ) {
|
||||||
if ( argCount == 0 ) {
|
if ( argCount == 0 ) {
|
||||||
@ -149,7 +156,7 @@ else if ( argCount == 2 ) {
|
|||||||
return this.toString();
|
return this.toString();
|
||||||
}
|
}
|
||||||
if ( "equals".equals( methodName ) && argCount == 1 ) {
|
if ( "equals".equals( methodName ) && argCount == 1 ) {
|
||||||
return Boolean.valueOf( proxy == args[0] );
|
return proxy == args[0];
|
||||||
}
|
}
|
||||||
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
||||||
return this.hashCode();
|
return this.hashCode();
|
||||||
|
@ -76,13 +76,16 @@ protected long getLength() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected InputStream getAsciiStream() throws SQLException {
|
protected InputStream getAsciiStream() throws SQLException {
|
||||||
resetIfNeeded();
|
return new ReaderInputStream( getCharacterStream() );
|
||||||
return new ReaderInputStream( characterStream.asReader() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Reader getCharacterStream() throws SQLException {
|
protected Reader getCharacterStream() throws SQLException {
|
||||||
|
return getUnderlyingStream().asReader();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CharacterStream getUnderlyingStream() throws SQLException {
|
||||||
resetIfNeeded();
|
resetIfNeeded();
|
||||||
return characterStream.asReader();
|
return characterStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getSubString(long start, int length) {
|
protected String getSubString(long start, int length) {
|
||||||
@ -95,20 +98,21 @@ protected String getSubString(long start, int length) {
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
* @throws UnsupportedOperationException if any methods other than {@link Clob#length()},
|
* @throws UnsupportedOperationException if any methods other than {@link Clob#length},
|
||||||
* {@link Clob#getAsciiStream()}, or {@link Clob#getCharacterStream()} are invoked.
|
* {@link Clob#getAsciiStream}, {@link Clob#getCharacterStream},
|
||||||
|
* {@link ClobImplementer#getUnderlyingStream}, {@link Clob#getSubString},
|
||||||
|
* {@link Clob#free}, or toString/equals/hashCode are invoked.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
final String methodName = method.getName();
|
final String methodName = method.getName();
|
||||||
final int argCount = method.getParameterTypes().length;
|
final int argCount = method.getParameterTypes().length;
|
||||||
|
|
||||||
if ( "length".equals( methodName ) && argCount == 0 ) {
|
if ( "length".equals( methodName ) && argCount == 0 ) {
|
||||||
return Long.valueOf( getLength() );
|
return getLength();
|
||||||
}
|
}
|
||||||
if ( "getUnderlyingStream".equals( methodName ) ) {
|
if ( "getUnderlyingStream".equals( methodName ) ) {
|
||||||
return characterStream;
|
return getUnderlyingStream(); // Reset stream if needed.
|
||||||
}
|
}
|
||||||
if ( "getAsciiStream".equals( methodName ) && argCount == 0 ) {
|
if ( "getAsciiStream".equals( methodName ) && argCount == 0 ) {
|
||||||
return getAsciiStream();
|
return getAsciiStream();
|
||||||
@ -156,7 +160,7 @@ else if ( argCount == 2 ) {
|
|||||||
return this.toString();
|
return this.toString();
|
||||||
}
|
}
|
||||||
if ( "equals".equals( methodName ) && argCount == 1 ) {
|
if ( "equals".equals( methodName ) && argCount == 1 ) {
|
||||||
return Boolean.valueOf( proxy == args[0] );
|
return proxy == args[0];
|
||||||
}
|
}
|
||||||
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
if ( "hashCode".equals( methodName ) && argCount == 0 ) {
|
||||||
return this.hashCode();
|
return this.hashCode();
|
||||||
|
@ -89,10 +89,9 @@ public static ClassLoader getProxyClassLoader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
if ( "findColumn".equals( method.getName() ) ) {
|
if ( "findColumn".equals( method.getName() ) ) {
|
||||||
return Integer.valueOf( findColumn( (String) args[0] ) );
|
return findColumn( (String) args[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isFirstArgColumnLabel( method, args ) ) {
|
if ( isFirstArgColumnLabel( method, args ) ) {
|
||||||
@ -168,10 +167,9 @@ private Method locateCorrespondingColumnIndexMethod(Method columnNameMethod) thr
|
|||||||
return columnNameMethod.getDeclaringClass().getMethod( columnNameMethod.getName(), actualParameterTypes );
|
return columnNameMethod.getDeclaringClass().getMethod( columnNameMethod.getName(), actualParameterTypes );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
private Object[] buildColumnIndexMethodArgs(Object[] incomingArgs, int columnIndex) {
|
private Object[] buildColumnIndexMethodArgs(Object[] incomingArgs, int columnIndex) {
|
||||||
final Object[] actualArgs = new Object[incomingArgs.length];
|
final Object[] actualArgs = new Object[incomingArgs.length];
|
||||||
actualArgs[0] = Integer.valueOf( columnIndex );
|
actualArgs[0] = columnIndex;
|
||||||
System.arraycopy( incomingArgs, 1, actualArgs, 1, incomingArgs.length - 1 );
|
System.arraycopy( incomingArgs, 1, actualArgs, 1, incomingArgs.length - 1 );
|
||||||
return actualArgs;
|
return actualArgs;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,6 @@
|
|||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
public class DriverManagerConnectionProviderImpl
|
public class DriverManagerConnectionProviderImpl
|
||||||
implements ConnectionProvider, Configurable, Stoppable, ServiceRegistryAwareService {
|
implements ConnectionProvider, Configurable, Stoppable, ServiceRegistryAwareService {
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, DriverManagerConnectionProviderImpl.class.getName() );
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, DriverManagerConnectionProviderImpl.class.getName() );
|
||||||
@ -145,7 +144,7 @@ else if ( serviceRegistry != null ) {
|
|||||||
|
|
||||||
isolation = ConfigurationHelper.getInteger( AvailableSettings.ISOLATION, configurationValues );
|
isolation = ConfigurationHelper.getInteger( AvailableSettings.ISOLATION, configurationValues );
|
||||||
if ( isolation != null ) {
|
if ( isolation != null ) {
|
||||||
LOG.jdbcIsolationLevel( Environment.isolationLevelToString( isolation.intValue() ) );
|
LOG.jdbcIsolationLevel( Environment.isolationLevelToString( isolation ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
url = (String) configurationValues.get( AvailableSettings.URL );
|
url = (String) configurationValues.get( AvailableSettings.URL );
|
||||||
@ -197,7 +196,7 @@ public Connection getConnection() throws SQLException {
|
|||||||
}
|
}
|
||||||
final Connection pooled = pool.remove( last );
|
final Connection pooled = pool.remove( last );
|
||||||
if ( isolation != null ) {
|
if ( isolation != null ) {
|
||||||
pooled.setTransactionIsolation( isolation.intValue() );
|
pooled.setTransactionIsolation( isolation );
|
||||||
}
|
}
|
||||||
if ( pooled.getAutoCommit() != autocommit ) {
|
if ( pooled.getAutoCommit() != autocommit ) {
|
||||||
pooled.setAutoCommit( autocommit );
|
pooled.setAutoCommit( autocommit );
|
||||||
@ -227,7 +226,7 @@ public Connection getConnection() throws SQLException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isolation != null ) {
|
if ( isolation != null ) {
|
||||||
conn.setTransactionIsolation( isolation.intValue() );
|
conn.setTransactionIsolation( isolation );
|
||||||
}
|
}
|
||||||
if ( conn.getAutoCommit() != autocommit ) {
|
if ( conn.getAutoCommit() != autocommit ) {
|
||||||
conn.setAutoCommit( autocommit );
|
conn.setAutoCommit( autocommit );
|
||||||
|
@ -174,12 +174,11 @@ public ResultSet getResultSet(CallableStatement statement, String name) {
|
|||||||
*
|
*
|
||||||
* @return {@code true} if the metadata indicates that the driver defines REF_CURSOR support
|
* @return {@code true} if the metadata indicates that the driver defines REF_CURSOR support
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public static boolean supportsRefCursors(DatabaseMetaData meta) {
|
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
|
// Standard JDBC REF_CURSOR support was not added until Java 8, so we need to use reflection to attempt to
|
||||||
// access these fields/methods...
|
// access these fields/methods...
|
||||||
try {
|
try {
|
||||||
return ( (Boolean) meta.getClass().getMethod( "supportsRefCursors" ).invoke( null ) ).booleanValue();
|
return (Boolean) meta.getClass().getMethod( "supportsRefCursors" ).invoke( null );
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException e) {
|
catch (NoSuchMethodException e) {
|
||||||
log.trace( "JDBC DatabaseMetaData class does not define supportsRefCursors method..." );
|
log.trace( "JDBC DatabaseMetaData class does not define supportsRefCursors method..." );
|
||||||
@ -193,7 +192,6 @@ public static boolean supportsRefCursors(DatabaseMetaData meta) {
|
|||||||
|
|
||||||
private static Integer refCursorTypeCode;
|
private static Integer refCursorTypeCode;
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
private int refCursorTypeCode() {
|
private int refCursorTypeCode() {
|
||||||
if ( refCursorTypeCode == null ) {
|
if ( refCursorTypeCode == null ) {
|
||||||
try {
|
try {
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||||
import org.hibernate.dialect.PostgreSQL9Dialect;
|
import org.hibernate.dialect.PostgreSQL9Dialect;
|
||||||
|
import org.hibernate.dialect.PostgresPlusDialect;
|
||||||
import org.hibernate.dialect.SQLServer2005Dialect;
|
import org.hibernate.dialect.SQLServer2005Dialect;
|
||||||
import org.hibernate.dialect.SQLServer2008Dialect;
|
import org.hibernate.dialect.SQLServer2008Dialect;
|
||||||
import org.hibernate.dialect.SQLServerDialect;
|
import org.hibernate.dialect.SQLServerDialect;
|
||||||
@ -104,6 +105,10 @@ public Dialect resolve(DatabaseInfo databaseInfo) {
|
|||||||
return new PostgreSQL81Dialect();
|
return new PostgreSQL81Dialect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( "EnterpriseDB".equals( databaseName ) ) {
|
||||||
|
return new PostgresPlusDialect();
|
||||||
|
}
|
||||||
|
|
||||||
if ( "Apache Derby".equals( databaseName ) ) {
|
if ( "Apache Derby".equals( databaseName ) ) {
|
||||||
final int majorVersion = databaseInfo.getDatabaseMajorVersion();
|
final int majorVersion = databaseInfo.getDatabaseMajorVersion();
|
||||||
final int minorVersion = databaseInfo.getDatabaseMinorVersion();
|
final int minorVersion = databaseInfo.getDatabaseMinorVersion();
|
||||||
|
@ -274,13 +274,12 @@ private void updateOrInsertOrDelete() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
private void select() {
|
private void select() {
|
||||||
out();
|
out();
|
||||||
indent++;
|
indent++;
|
||||||
newline();
|
newline();
|
||||||
parenCounts.addLast( Integer.valueOf( parensSinceSelect ) );
|
parenCounts.addLast( parensSinceSelect );
|
||||||
afterByOrFromOrSelects.addLast( Boolean.valueOf( afterByOrSetOrFromOrSelect ) );
|
afterByOrFromOrSelects.addLast( afterByOrSetOrFromOrSelect );
|
||||||
parensSinceSelect = 0;
|
parensSinceSelect = 0;
|
||||||
afterByOrSetOrFromOrSelect = true;
|
afterByOrSetOrFromOrSelect = true;
|
||||||
}
|
}
|
||||||
@ -332,13 +331,12 @@ private void values() {
|
|||||||
afterValues = true;
|
afterValues = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
private void closeParen() {
|
private void closeParen() {
|
||||||
parensSinceSelect--;
|
parensSinceSelect--;
|
||||||
if ( parensSinceSelect < 0 ) {
|
if ( parensSinceSelect < 0 ) {
|
||||||
indent--;
|
indent--;
|
||||||
parensSinceSelect = parenCounts.removeLast();
|
parensSinceSelect = parenCounts.removeLast();
|
||||||
afterByOrSetOrFromOrSelect = afterByOrFromOrSelects.removeLast().booleanValue();
|
afterByOrSetOrFromOrSelect = afterByOrFromOrSelects.removeLast();
|
||||||
}
|
}
|
||||||
if ( inFunction > 0 ) {
|
if ( inFunction > 0 ) {
|
||||||
inFunction--;
|
inFunction--;
|
||||||
|
@ -106,7 +106,7 @@ protected HQLQueryPlan(
|
|||||||
this.translators = new QueryTranslator[length];
|
this.translators = new QueryTranslator[length];
|
||||||
|
|
||||||
final List<String> sqlStringList = new ArrayList<String>();
|
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 boolean hasCollectionRole = (collectionRole == null);
|
||||||
final Map querySubstitutions = factory.getSettings().getQuerySubstitutions();
|
final Map querySubstitutions = factory.getSettings().getQuerySubstitutions();
|
||||||
|
@ -129,7 +129,7 @@ public int getOrdinalParameterSourceLocation(int position) {
|
|||||||
*
|
*
|
||||||
* @return The named parameter names
|
* @return The named parameter names
|
||||||
*/
|
*/
|
||||||
public Set getNamedParameterNames() {
|
public Set<String> getNamedParameterNames() {
|
||||||
return namedDescriptorMap.keySet();
|
return namedDescriptorMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,6 @@ private static class DynamicFilterKey implements Serializable {
|
|||||||
private final Map<String,Integer> parameterMetadata;
|
private final Map<String,Integer> parameterMetadata;
|
||||||
private final int hashCode;
|
private final int hashCode;
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
private DynamicFilterKey(FilterImpl filter) {
|
private DynamicFilterKey(FilterImpl filter) {
|
||||||
this.filterName = filter.getName();
|
this.filterName = filter.getName();
|
||||||
if ( filter.getParameters().isEmpty() ) {
|
if ( filter.getParameters().isEmpty() ) {
|
||||||
|
@ -782,7 +782,6 @@ public InsertActionSorter() {
|
|||||||
/**
|
/**
|
||||||
* Sort the insert actions.
|
* Sort the insert actions.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "UnnecessaryBoxing" })
|
|
||||||
public void sort() {
|
public void sort() {
|
||||||
// the list of entity names that indicate the batch number
|
// the list of entity names that indicate the batch number
|
||||||
for ( EntityInsertAction action : (List<EntityInsertAction>) insertions ) {
|
for ( EntityInsertAction action : (List<EntityInsertAction>) insertions ) {
|
||||||
@ -831,7 +830,6 @@ public void sort() {
|
|||||||
*
|
*
|
||||||
* @return An appropriate batch number; todo document this process better
|
* @return An appropriate batch number; todo document this process better
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing", "unchecked" })
|
|
||||||
private Integer findBatchNumber(
|
private Integer findBatchNumber(
|
||||||
EntityInsertAction action,
|
EntityInsertAction action,
|
||||||
String entityName) {
|
String entityName) {
|
||||||
|
@ -74,10 +74,9 @@ protected UserTransaction locateUserTransaction() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public Object getTransactionIdentifier(Transaction transaction) {
|
public Object getTransactionIdentifier(Transaction transaction) {
|
||||||
// WebSphere, however, is not a sane JEE/JTA container...
|
// WebSphere, however, is not a sane JEE/JTA container...
|
||||||
return Integer.valueOf( transaction.hashCode() );
|
return transaction.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TransactionManagerAdapter implements TransactionManager {
|
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 Map<String, SelectExpression> selectExpressionsByResultVariable = new HashMap<String, SelectExpression>();
|
||||||
|
|
||||||
private Set querySpaces = new HashSet();
|
private Set<Serializable> querySpaces = new HashSet<Serializable>();
|
||||||
|
|
||||||
private int parameterCount;
|
private int parameterCount;
|
||||||
private Map namedParameters = new HashMap();
|
private Map namedParameters = new HashMap();
|
||||||
@ -315,7 +315,7 @@ public void reportWarning(String s) {
|
|||||||
*
|
*
|
||||||
* @return A set of table names (Strings).
|
* @return A set of table names (Strings).
|
||||||
*/
|
*/
|
||||||
public Set getQuerySpaces() {
|
public Set<Serializable> getQuerySpaces() {
|
||||||
return querySpaces;
|
return querySpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.hql.internal.ast;
|
package org.hibernate.hql.internal.ast;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -342,7 +343,7 @@ public String[][] getColumnNames() {
|
|||||||
return getWalker().getSelectClause().getColumnNames();
|
return getWalker().getSelectClause().getColumnNames();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Set getQuerySpaces() {
|
public Set<Serializable> getQuerySpaces() {
|
||||||
return getWalker().getQuerySpaces();
|
return getWalker().getQuerySpaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -108,7 +109,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||||||
private final Map joins = new LinkedHashMap();
|
private final Map joins = new LinkedHashMap();
|
||||||
private final List orderByTokens = new ArrayList();
|
private final List orderByTokens = new ArrayList();
|
||||||
private final List groupByTokens = 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 Set entitiesToFetch = new HashSet();
|
||||||
|
|
||||||
private final Map pathAliases = new HashMap();
|
private final Map pathAliases = new HashMap();
|
||||||
@ -822,7 +823,7 @@ else if ( collections.containsKey( name ) ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Set getQuerySpaces() {
|
public final Set<Serializable> getQuerySpaces() {
|
||||||
return querySpaces;
|
return querySpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,9 +837,7 @@ boolean isShallowQuery() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addQuerySpaces(Serializable[] spaces) {
|
void addQuerySpaces(Serializable[] spaces) {
|
||||||
for ( int i = 0; i < spaces.length; i++ ) {
|
Collections.addAll( querySpaces, spaces );
|
||||||
querySpaces.add( spaces[i] );
|
|
||||||
}
|
|
||||||
if ( superQuery != null ) superQuery.addQuerySpaces( spaces );
|
if ( superQuery != null ) superQuery.addQuerySpaces( spaces );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -937,6 +936,7 @@ void addPathAliasAndJoin(String path, String alias, JoinSequence joinSequence) {
|
|||||||
pathJoins.put( path, joinSequence );
|
pathJoins.put( path, joinSequence );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List list(SessionImplementor session, QueryParameters queryParameters)
|
public List list(SessionImplementor session, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
return list( session, queryParameters, getQuerySpaces(), actualReturnTypes );
|
return list( session, queryParameters, getQuerySpaces(), actualReturnTypes );
|
||||||
@ -945,6 +945,7 @@ public List list(SessionImplementor session, QueryParameters queryParameters)
|
|||||||
/**
|
/**
|
||||||
* Return the query results as an iterator
|
* Return the query results as an iterator
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Iterator iterate(QueryParameters queryParameters, EventSource session)
|
public Iterator iterate(QueryParameters queryParameters, EventSource session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.hql.spi;
|
package org.hibernate.hql.spi;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -111,7 +112,7 @@ int executeUpdate(QueryParameters queryParameters, SessionImplementor session)
|
|||||||
*
|
*
|
||||||
* @return A set of query spaces (table names).
|
* @return A set of query spaces (table names).
|
||||||
*/
|
*/
|
||||||
Set getQuerySpaces();
|
Set<Serializable> getQuerySpaces();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the query identifier for this translator. The query identifier is
|
* Retrieve the query identifier for this translator. The query identifier is
|
||||||
|
@ -163,16 +163,14 @@ protected void releaseTempTable(Queryable persister, SessionImplementor session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
protected boolean shouldIsolateTemporaryTableDDL(SessionImplementor session) {
|
protected boolean shouldIsolateTemporaryTableDDL(SessionImplementor session) {
|
||||||
Boolean dialectVote = session.getFactory().getDialect().performTemporaryTableDDLInIsolation();
|
Boolean dialectVote = session.getFactory().getDialect().performTemporaryTableDDLInIsolation();
|
||||||
if ( dialectVote != null ) {
|
if ( dialectVote != null ) {
|
||||||
return dialectVote.booleanValue();
|
return dialectVote;
|
||||||
}
|
}
|
||||||
return session.getFactory().getSettings().isDataDefinitionImplicitCommit();
|
return session.getFactory().getSettings().isDataDefinitionImplicitCommit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
protected boolean shouldTransactIsolatedTemporaryTableDDL(SessionImplementor session) {
|
protected boolean shouldTransactIsolatedTemporaryTableDDL(SessionImplementor session) {
|
||||||
// is there ever a time when it makes sense to do this?
|
// is there ever a time when it makes sense to do this?
|
||||||
// return session.getFactory().getSettings().isDataDefinitionInTransactionSupported();
|
// return session.getFactory().getSettings().isDataDefinitionInTransactionSupported();
|
||||||
|
@ -67,7 +67,6 @@ public static boolean isPooledOptimizer(String optimizerName) {
|
|||||||
* @deprecated Use {@link #buildOptimizer(String, Class, int, long)} instead
|
* @deprecated Use {@link #buildOptimizer(String, Class, int, long)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
|
||||||
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize) {
|
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize) {
|
||||||
final Class<? extends Optimizer> optimizerClass;
|
final Class<? extends Optimizer> optimizerClass;
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ public static Optimizer buildOptimizer(String type, Class returnClass, int incre
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final Constructor ctor = optimizerClass.getConstructor( CTOR_SIG );
|
final Constructor ctor = optimizerClass.getConstructor( CTOR_SIG );
|
||||||
return (Optimizer) ctor.newInstance( returnClass, Integer.valueOf( incrementSize ) );
|
return (Optimizer) ctor.newInstance( returnClass, incrementSize );
|
||||||
}
|
}
|
||||||
catch( Throwable ignore ) {
|
catch( Throwable ignore ) {
|
||||||
LOG.unableToInstantiateOptimizer( type );
|
LOG.unableToInstantiateOptimizer( type );
|
||||||
@ -110,7 +109,6 @@ private static Optimizer buildFallbackOptimizer(Class returnClass, int increment
|
|||||||
*
|
*
|
||||||
* @return The built optimizer
|
* @return The built optimizer
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing", "deprecation" })
|
|
||||||
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize, long explicitInitialValue) {
|
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize, long explicitInitialValue) {
|
||||||
final Optimizer optimizer = buildOptimizer( type, returnClass, incrementSize );
|
final Optimizer optimizer = buildOptimizer( type, returnClass, incrementSize );
|
||||||
if ( InitialValueAwareOptimizer.class.isInstance( optimizer ) ) {
|
if ( InitialValueAwareOptimizer.class.isInstance( optimizer ) ) {
|
||||||
|
@ -92,7 +92,7 @@ public abstract class AbstractQueryImpl implements Query {
|
|||||||
private List values = new ArrayList(4);
|
private List values = new ArrayList(4);
|
||||||
private List types = new ArrayList(4);
|
private List types = new ArrayList(4);
|
||||||
private Map<String,TypedValue> namedParameters = new HashMap<String, TypedValue>(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 Object optionalObject;
|
||||||
private Serializable optionalId;
|
private Serializable optionalId;
|
||||||
@ -257,24 +257,20 @@ public Query setCollectionKey(Serializable collectionKey) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isReadOnly() {
|
public boolean isReadOnly() {
|
||||||
return ( readOnly == null ?
|
return ( readOnly == null ?
|
||||||
getSession().getPersistenceContext().isDefaultReadOnly() :
|
getSession().getPersistenceContext().isDefaultReadOnly() :
|
||||||
readOnly.booleanValue()
|
readOnly
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Query setReadOnly(boolean readOnly) {
|
public Query setReadOnly(boolean readOnly) {
|
||||||
this.readOnly = Boolean.valueOf( readOnly );
|
this.readOnly = readOnly;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Query setResultTransformer(ResultTransformer transformer) {
|
public Query setResultTransformer(ResultTransformer transformer) {
|
||||||
this.resultTransformer = transformer;
|
this.resultTransformer = transformer;
|
||||||
return this;
|
return this;
|
||||||
@ -295,7 +291,7 @@ public void setOptionalObject(Object optionalObject) {
|
|||||||
SessionImplementor getSession() {
|
SessionImplementor getSession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public abstract LockOptions getLockOptions();
|
public abstract LockOptions getLockOptions();
|
||||||
|
|
||||||
|
|
||||||
@ -306,8 +302,8 @@ SessionImplementor getSession() {
|
|||||||
*
|
*
|
||||||
* @return Shallow copy of the named parameter value map
|
* @return Shallow copy of the named parameter value map
|
||||||
*/
|
*/
|
||||||
protected Map getNamedParams() {
|
protected Map<String, TypedValue> getNamedParams() {
|
||||||
return new HashMap( namedParameters );
|
return new HashMap<String, TypedValue>( namedParameters );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -324,6 +320,7 @@ protected Map getNamedParams() {
|
|||||||
* @return Array of named parameter names.
|
* @return Array of named parameter names.
|
||||||
* @throws HibernateException
|
* @throws HibernateException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getNamedParameters() throws HibernateException {
|
public String[] getNamedParameters() throws HibernateException {
|
||||||
return ArrayHelper.toStringArray( parameterMetadata.getNamedParameterNames() );
|
return ArrayHelper.toStringArray( parameterMetadata.getNamedParameterNames() );
|
||||||
}
|
}
|
||||||
@ -344,7 +341,7 @@ public boolean hasNamedParameters() {
|
|||||||
*
|
*
|
||||||
* @return The parameter list value map.
|
* @return The parameter list value map.
|
||||||
*/
|
*/
|
||||||
protected Map getNamedParameterLists() {
|
protected Map<String, TypedValue> getNamedParameterLists() {
|
||||||
return namedParameterLists;
|
return namedParameterLists;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,7 +385,7 @@ protected void verifyParameters() throws QueryException {
|
|||||||
*/
|
*/
|
||||||
protected void verifyParameters(boolean reserveFirstParameter) throws HibernateException {
|
protected void verifyParameters(boolean reserveFirstParameter) throws HibernateException {
|
||||||
if ( parameterMetadata.getNamedParameterNames().size() != namedParameters.size() + namedParameterLists.size() ) {
|
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( namedParameterLists.keySet() );
|
||||||
missingParams.removeAll( namedParameters.keySet() );
|
missingParams.removeAll( namedParameters.keySet() );
|
||||||
throw new QueryException( "Not all named parameters have been set: " + missingParams, getQueryString() );
|
throw new QueryException( "Not all named parameters have been set: " + missingParams, getQueryString() );
|
||||||
@ -777,6 +774,7 @@ public Query setBigInteger(String name, BigInteger number) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Query setParameterList(String name, Collection vals, Type type) throws HibernateException {
|
public Query setParameterList(String name, Collection vals, Type type) throws HibernateException {
|
||||||
if ( !parameterMetadata.getNamedParameterNames().contains( name ) ) {
|
if ( !parameterMetadata.getNamedParameterNames().contains( name ) ) {
|
||||||
throw new IllegalArgumentException("Parameter " + name + " does not exist as a named parameter in [" + getQueryString() + "]");
|
throw new IllegalArgumentException("Parameter " + name + " does not exist as a named parameter in [" + getQueryString() + "]");
|
||||||
@ -791,9 +789,8 @@ public Query setParameterList(String name, Collection vals, Type type) throws Hi
|
|||||||
*/
|
*/
|
||||||
protected String expandParameterLists(Map namedParamsCopy) {
|
protected String expandParameterLists(Map namedParamsCopy) {
|
||||||
String query = this.queryString;
|
String query = this.queryString;
|
||||||
Iterator iter = namedParameterLists.entrySet().iterator();
|
for ( Map.Entry<String, TypedValue> stringTypedValueEntry : namedParameterLists.entrySet() ) {
|
||||||
while ( iter.hasNext() ) {
|
Map.Entry me = (Map.Entry) stringTypedValueEntry;
|
||||||
Map.Entry me = (Map.Entry) iter.next();
|
|
||||||
query = expandParameterList( query, (String) me.getKey(), (TypedValue) me.getValue(), namedParamsCopy );
|
query = expandParameterList( query, (String) me.getKey(), (TypedValue) me.getValue(), namedParamsCopy );
|
||||||
}
|
}
|
||||||
return query;
|
return query;
|
||||||
|
@ -186,7 +186,6 @@ public Query getNamedSQLQuery(String queryName) throws MappingException {
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
private void initQuery(Query query, NamedQueryDefinition nqd) {
|
private void initQuery(Query query, NamedQueryDefinition nqd) {
|
||||||
// todo : cacheable and readonly should be Boolean rather than boolean...
|
// todo : cacheable and readonly should be Boolean rather than boolean...
|
||||||
query.setCacheable( nqd.isCacheable() );
|
query.setCacheable( nqd.isCacheable() );
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.internal;
|
package org.hibernate.internal;
|
||||||
|
|
||||||
|
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||||
|
import static org.jboss.logging.Logger.Level.ERROR;
|
||||||
|
import static org.jboss.logging.Logger.Level.INFO;
|
||||||
|
import static org.jboss.logging.Logger.Level.WARN;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -33,37 +38,32 @@
|
|||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.naming.NameNotFoundException;
|
import javax.naming.NameNotFoundException;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
import javax.transaction.Synchronization;
|
import javax.transaction.Synchronization;
|
||||||
import javax.transaction.SystemException;
|
import javax.transaction.SystemException;
|
||||||
|
|
||||||
import org.jboss.logging.BasicLogger;
|
|
||||||
import org.jboss.logging.Cause;
|
|
||||||
import org.jboss.logging.LogMessage;
|
|
||||||
import org.jboss.logging.Message;
|
|
||||||
import org.jboss.logging.MessageLogger;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.cache.CacheException;
|
import org.hibernate.cache.CacheException;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.jdbc.dialect.spi.DialectResolver;
|
import org.hibernate.engine.jdbc.dialect.spi.DialectResolver;
|
||||||
|
import org.hibernate.engine.jndi.JndiException;
|
||||||
|
import org.hibernate.engine.jndi.JndiNameException;
|
||||||
import org.hibernate.engine.loading.internal.CollectionLoadContext;
|
import org.hibernate.engine.loading.internal.CollectionLoadContext;
|
||||||
import org.hibernate.engine.loading.internal.EntityLoadContext;
|
import org.hibernate.engine.loading.internal.EntityLoadContext;
|
||||||
import org.hibernate.engine.spi.CollectionKey;
|
import org.hibernate.engine.spi.CollectionKey;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.id.IntegralDataTypeHolder;
|
import org.hibernate.id.IntegralDataTypeHolder;
|
||||||
import org.hibernate.engine.jndi.JndiException;
|
|
||||||
import org.hibernate.engine.jndi.JndiNameException;
|
|
||||||
import org.hibernate.type.BasicType;
|
import org.hibernate.type.BasicType;
|
||||||
import org.hibernate.type.SerializationException;
|
import org.hibernate.type.SerializationException;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
|
import org.jboss.logging.BasicLogger;
|
||||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
import org.jboss.logging.Cause;
|
||||||
import static org.jboss.logging.Logger.Level.ERROR;
|
import org.jboss.logging.LogMessage;
|
||||||
import static org.jboss.logging.Logger.Level.INFO;
|
import org.jboss.logging.Message;
|
||||||
import static org.jboss.logging.Logger.Level.WARN;
|
import org.jboss.logging.MessageLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The jboss-logging {@link MessageLogger} for the hibernate-core module. It reserves message ids ranging from
|
* The jboss-logging {@link MessageLogger} for the hibernate-core module. It reserves message ids ranging from
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @author Brett Meyer
|
* @author Brett Meyer
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public final class ReflectHelper {
|
public final class ReflectHelper {
|
||||||
|
|
||||||
//TODO: this dependency is kinda Bad
|
//TODO: this dependency is kinda Bad
|
||||||
|
@ -2325,7 +2325,7 @@ protected final void loadCollectionSubselect(
|
|||||||
protected List list(
|
protected List list(
|
||||||
final SessionImplementor session,
|
final SessionImplementor session,
|
||||||
final QueryParameters queryParameters,
|
final QueryParameters queryParameters,
|
||||||
final Set querySpaces,
|
final Set<Serializable> querySpaces,
|
||||||
final Type[] resultTypes) throws HibernateException {
|
final Type[] resultTypes) throws HibernateException {
|
||||||
|
|
||||||
final boolean cacheable = factory.getSettings().isQueryCacheEnabled() &&
|
final boolean cacheable = factory.getSettings().isQueryCacheEnabled() &&
|
||||||
@ -2346,7 +2346,7 @@ private List listIgnoreQueryCache(SessionImplementor session, QueryParameters qu
|
|||||||
private List listUsingQueryCache(
|
private List listUsingQueryCache(
|
||||||
final SessionImplementor session,
|
final SessionImplementor session,
|
||||||
final QueryParameters queryParameters,
|
final QueryParameters queryParameters,
|
||||||
final Set querySpaces,
|
final Set<Serializable> querySpaces,
|
||||||
final Type[] resultTypes) {
|
final Type[] resultTypes) {
|
||||||
|
|
||||||
QueryCache queryCache = factory.getQueryCache( queryParameters.getCacheRegion() );
|
QueryCache queryCache = factory.getQueryCache( queryParameters.getCacheRegion() );
|
||||||
@ -2423,7 +2423,7 @@ private CacheableResultTransformer createCacheableResultTransformer(QueryParamet
|
|||||||
private List getResultFromQueryCache(
|
private List getResultFromQueryCache(
|
||||||
final SessionImplementor session,
|
final SessionImplementor session,
|
||||||
final QueryParameters queryParameters,
|
final QueryParameters queryParameters,
|
||||||
final Set querySpaces,
|
final Set<Serializable> querySpaces,
|
||||||
final Type[] resultTypes,
|
final Type[] resultTypes,
|
||||||
final QueryCache queryCache,
|
final QueryCache queryCache,
|
||||||
final QueryKey key) {
|
final QueryKey key) {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.loader.custom;
|
package org.hibernate.loader.custom;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.ResultSetMetaData;
|
import java.sql.ResultSetMetaData;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -70,7 +71,7 @@ public class CustomLoader extends Loader {
|
|||||||
// Currently *not* cachable if autodiscover types is in effect (e.g. "select * ...")
|
// Currently *not* cachable if autodiscover types is in effect (e.g. "select * ...")
|
||||||
|
|
||||||
private final String sql;
|
private final String sql;
|
||||||
private final Set querySpaces = new HashSet();
|
private final Set<Serializable> querySpaces = new HashSet<Serializable>();
|
||||||
private final Map namedParameterBindPoints;
|
private final Map namedParameterBindPoints;
|
||||||
|
|
||||||
private final Queryable[] entityPersisters;
|
private final Queryable[] entityPersisters;
|
||||||
|
@ -73,7 +73,7 @@ public CollectionElementLoader(
|
|||||||
persister,
|
persister,
|
||||||
ArrayHelper.join(
|
ArrayHelper.join(
|
||||||
collectionPersister.getKeyColumnNames(),
|
collectionPersister.getKeyColumnNames(),
|
||||||
collectionPersister.getIndexColumnNames()
|
collectionPersister.toColumns("index")
|
||||||
),
|
),
|
||||||
1,
|
1,
|
||||||
LockMode.NONE,
|
LockMode.NONE,
|
||||||
|
@ -5034,12 +5034,11 @@ private String determinePkByNaturalIdQuery(boolean[] valueNullness) {
|
|||||||
return generateEntityIdByNaturalIdSql( valueNullness );
|
return generateEntityIdByNaturalIdSql( valueNullness );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
protected boolean isNaturalIdNonNullable() {
|
protected boolean isNaturalIdNonNullable() {
|
||||||
if ( naturalIdIsNonNullable == null ) {
|
if ( naturalIdIsNonNullable == null ) {
|
||||||
naturalIdIsNonNullable = determineNaturalIdNullability();
|
naturalIdIsNonNullable = determineNaturalIdNullability();
|
||||||
}
|
}
|
||||||
return naturalIdIsNonNullable.booleanValue();
|
return naturalIdIsNonNullable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean determineNaturalIdNullability() {
|
private boolean determineNaturalIdNullability() {
|
||||||
|
@ -132,7 +132,7 @@ else if ( isConnectedToSession() ) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// use the read-only/modifiable setting indicated during deserialization
|
// use the read-only/modifiable setting indicated during deserialization
|
||||||
setReadOnly( readOnlyBeforeAttachedToSession.booleanValue() );
|
setReadOnly( readOnlyBeforeAttachedToSession );
|
||||||
readOnlyBeforeAttachedToSession = null;
|
readOnlyBeforeAttachedToSession = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
|
||||||
* indicated by the @author tags or express copyright attribution
|
|
||||||
* statements applied by the authors. All third-party contributions are
|
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
|
||||||
*
|
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
|
||||||
* Lesser General Public License, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this distribution; if not, write to:
|
|
||||||
* Free Software Foundation, Inc.
|
|
||||||
* 51 Franklin Street, Fifth Floor
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.hibernate.proxy.dom4j;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import org.dom4j.Element;
|
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
|
||||||
import org.hibernate.proxy.AbstractLazyInitializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lazy initializer for "dom4j" entity representations.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public class Dom4jLazyInitializer extends AbstractLazyInitializer implements Serializable {
|
|
||||||
|
|
||||||
Dom4jLazyInitializer(String entityName, Serializable id, SessionImplementor session) {
|
|
||||||
super(entityName, id, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element getElement() {
|
|
||||||
return (Element) getImplementation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class getPersistentClass() {
|
|
||||||
throw new UnsupportedOperationException("dom4j entity representation");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,590 +0,0 @@
|
|||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
|
||||||
* indicated by the @author tags or express copyright attribution
|
|
||||||
* statements applied by the authors. All third-party contributions are
|
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
|
||||||
*
|
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
|
||||||
* Lesser General Public License, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this distribution; if not, write to:
|
|
||||||
* Free Software Foundation, Inc.
|
|
||||||
* 51 Franklin Street, Fifth Floor
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.hibernate.proxy.dom4j;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.dom4j.Attribute;
|
|
||||||
import org.dom4j.Branch;
|
|
||||||
import org.dom4j.CDATA;
|
|
||||||
import org.dom4j.Comment;
|
|
||||||
import org.dom4j.Document;
|
|
||||||
import org.dom4j.Element;
|
|
||||||
import org.dom4j.Entity;
|
|
||||||
import org.dom4j.InvalidXPathException;
|
|
||||||
import org.dom4j.Namespace;
|
|
||||||
import org.dom4j.Node;
|
|
||||||
import org.dom4j.ProcessingInstruction;
|
|
||||||
import org.dom4j.QName;
|
|
||||||
import org.dom4j.Text;
|
|
||||||
import org.dom4j.Visitor;
|
|
||||||
import org.dom4j.XPath;
|
|
||||||
|
|
||||||
import org.hibernate.proxy.HibernateProxy;
|
|
||||||
import org.hibernate.proxy.LazyInitializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Proxy for "dom4j" entity representations.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public class Dom4jProxy implements HibernateProxy, Element, Serializable {
|
|
||||||
|
|
||||||
private Dom4jLazyInitializer li;
|
|
||||||
|
|
||||||
public Dom4jProxy(Dom4jLazyInitializer li) {
|
|
||||||
this.li = li;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object writeReplace() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LazyInitializer getHibernateLazyInitializer() {
|
|
||||||
return li;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QName getQName() {
|
|
||||||
return target().getQName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public QName getQName(String s) {
|
|
||||||
return target().getQName( s );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQName(QName qName) {
|
|
||||||
target().setQName( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Namespace getNamespace() {
|
|
||||||
return target().getNamespace();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Namespace getNamespaceForPrefix(String s) {
|
|
||||||
return target().getNamespaceForPrefix( s );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Namespace getNamespaceForURI(String s) {
|
|
||||||
return target().getNamespaceForURI( s );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List getNamespacesForURI(String s) {
|
|
||||||
return target().getNamespacesForURI( s );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNamespacePrefix() {
|
|
||||||
return target().getNamespacePrefix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNamespaceURI() {
|
|
||||||
return target().getNamespaceURI();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQualifiedName() {
|
|
||||||
return target().getQualifiedName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List additionalNamespaces() {
|
|
||||||
return target().additionalNamespaces();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List declaredNamespaces() {
|
|
||||||
return target().declaredNamespaces();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addAttribute(String attrName, String text) {
|
|
||||||
return target().addAttribute( attrName, text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addAttribute(QName attrName, String text) {
|
|
||||||
return target().addAttribute( attrName, text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addComment(String text) {
|
|
||||||
return target().addComment( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addCDATA(String text) {
|
|
||||||
return target().addCDATA( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addEntity(String name, String text) {
|
|
||||||
return target().addEntity( name, text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addNamespace(String prefix, String uri) {
|
|
||||||
return target().addNamespace( prefix, uri );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addProcessingInstruction(String target, String text) {
|
|
||||||
return target().addProcessingInstruction( target, text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addProcessingInstruction(String target, Map data) {
|
|
||||||
return target().addProcessingInstruction( target, data );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addText(String text) {
|
|
||||||
return target().addText( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Attribute attribute) {
|
|
||||||
target().add( attribute );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(CDATA cdata) {
|
|
||||||
target().add( cdata );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Entity entity) {
|
|
||||||
target().add( entity );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Text text) {
|
|
||||||
target().add( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Namespace namespace) {
|
|
||||||
target().add( namespace );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(Attribute attribute) {
|
|
||||||
return target().remove( attribute );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(CDATA cdata) {
|
|
||||||
return target().remove( cdata );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(Entity entity) {
|
|
||||||
return target().remove( entity );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(Namespace namespace) {
|
|
||||||
return target().remove( namespace );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(Text text) {
|
|
||||||
return target().remove( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean supportsParent() {
|
|
||||||
return target().supportsParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element getParent() {
|
|
||||||
return target().getParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParent(Element element) {
|
|
||||||
target().setParent( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Document getDocument() {
|
|
||||||
return target().getDocument();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocument(Document document) {
|
|
||||||
target().setDocument( document );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReadOnly() {
|
|
||||||
return target().isReadOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasContent() {
|
|
||||||
return target().hasContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return target().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
target().setName( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
return target().getText();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text) {
|
|
||||||
target().setText( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTextTrim() {
|
|
||||||
return target().getTextTrim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStringValue() {
|
|
||||||
return target().getStringValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return target().getPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath(Element element) {
|
|
||||||
return target().getPath( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUniquePath() {
|
|
||||||
return target().getUniquePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUniquePath(Element element) {
|
|
||||||
return target().getUniquePath( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String asXML() {
|
|
||||||
return target().asXML();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(Writer writer) throws IOException {
|
|
||||||
target().write( writer );
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getNodeType() {
|
|
||||||
return target().getNodeType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeTypeName() {
|
|
||||||
return target().getNodeTypeName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node detach() {
|
|
||||||
Element parent = target().getParent();
|
|
||||||
if (parent!=null) parent.remove(this);
|
|
||||||
return target().detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List selectNodes(String xpath) {
|
|
||||||
return target().selectNodes( xpath );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object selectObject(String xpath) {
|
|
||||||
return target().selectObject( xpath );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List selectNodes(String xpath, String comparison) {
|
|
||||||
return target().selectNodes( xpath, comparison );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List selectNodes(String xpath, String comparison, boolean removeDups) {
|
|
||||||
return target().selectNodes( xpath, comparison, removeDups );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node selectSingleNode(String xpath) {
|
|
||||||
return target().selectSingleNode( xpath );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String valueOf(String xpath) {
|
|
||||||
return target().valueOf( xpath );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Number numberValueOf(String xpath) {
|
|
||||||
return target().numberValueOf( xpath );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(String xpath) {
|
|
||||||
return target().matches( xpath );
|
|
||||||
}
|
|
||||||
|
|
||||||
public XPath createXPath(String xpath) throws InvalidXPathException {
|
|
||||||
return target().createXPath( xpath );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node asXPathResult(Element element) {
|
|
||||||
return target().asXPathResult( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void accept(Visitor visitor) {
|
|
||||||
target().accept( visitor );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object clone() {
|
|
||||||
return target().clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getData() {
|
|
||||||
return target().getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(Object data) {
|
|
||||||
target().setData( data );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List attributes() {
|
|
||||||
return target().attributes();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAttributes(List list) {
|
|
||||||
target().setAttributes( list );
|
|
||||||
}
|
|
||||||
|
|
||||||
public int attributeCount() {
|
|
||||||
return target().attributeCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterator attributeIterator() {
|
|
||||||
return target().attributeIterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Attribute attribute(int i) {
|
|
||||||
return target().attribute( i );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Attribute attribute(String name) {
|
|
||||||
return target().attribute( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Attribute attribute(QName qName) {
|
|
||||||
return target().attribute( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String attributeValue(String name) {
|
|
||||||
return target().attributeValue( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String attributeValue(String name, String defaultValue) {
|
|
||||||
return target().attributeValue( name, defaultValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String attributeValue(QName qName) {
|
|
||||||
return target().attributeValue( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String attributeValue(QName qName, String defaultValue) {
|
|
||||||
return target().attributeValue( qName, defaultValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
public void setAttributeValue(String name, String value) {
|
|
||||||
target().setAttributeValue( name, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
public void setAttributeValue(QName qName, String value) {
|
|
||||||
target().setAttributeValue( qName, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element element(String name) {
|
|
||||||
return target().element( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element element(QName qName) {
|
|
||||||
return target().element( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List elements() {
|
|
||||||
return target().elements();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List elements(String name) {
|
|
||||||
return target().elements( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List elements(QName qName) {
|
|
||||||
return target().elements( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterator elementIterator() {
|
|
||||||
return target().elementIterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterator elementIterator(String name) {
|
|
||||||
return target().elementIterator( name );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterator elementIterator(QName qName) {
|
|
||||||
return target().elementIterator( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRootElement() {
|
|
||||||
return target().isRootElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasMixedContent() {
|
|
||||||
return target().hasMixedContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTextOnly() {
|
|
||||||
return target().isTextOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void appendAttributes(Element element) {
|
|
||||||
target().appendAttributes( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element createCopy() {
|
|
||||||
return target().createCopy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element createCopy(String name) {
|
|
||||||
return target().createCopy( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element createCopy(QName qName) {
|
|
||||||
return target().createCopy( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String elementText(String name) {
|
|
||||||
return target().elementText( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String elementText(QName qName) {
|
|
||||||
return target().elementText( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String elementTextTrim(String name) {
|
|
||||||
return target().elementTextTrim( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String elementTextTrim(QName qName) {
|
|
||||||
return target().elementTextTrim( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node getXPathResult(int i) {
|
|
||||||
return target().getXPathResult( i );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node node(int i) {
|
|
||||||
return target().node( i );
|
|
||||||
}
|
|
||||||
|
|
||||||
public int indexOf(Node node) {
|
|
||||||
return target().indexOf( node );
|
|
||||||
}
|
|
||||||
|
|
||||||
public int nodeCount() {
|
|
||||||
return target().nodeCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element elementByID(String id) {
|
|
||||||
return target().elementByID( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List content() {
|
|
||||||
return target().content();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterator nodeIterator() {
|
|
||||||
return target().nodeIterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(List list) {
|
|
||||||
target().setContent( list );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void appendContent(Branch branch) {
|
|
||||||
target().appendContent( branch );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearContent() {
|
|
||||||
target().clearContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List processingInstructions() {
|
|
||||||
return target().processingInstructions();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List processingInstructions(String name) {
|
|
||||||
return target().processingInstructions( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProcessingInstruction processingInstruction(String name) {
|
|
||||||
return target().processingInstruction( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProcessingInstructions(List list) {
|
|
||||||
target().setProcessingInstructions( list );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addElement(String name) {
|
|
||||||
return target().addElement( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addElement(QName qName) {
|
|
||||||
return target().addElement( qName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addElement(String name, String text) {
|
|
||||||
return target().addElement( name, text );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removeProcessingInstruction(String name) {
|
|
||||||
return target().removeProcessingInstruction( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Node node) {
|
|
||||||
target().add( node );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Comment comment) {
|
|
||||||
target().add( comment );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Element element) {
|
|
||||||
target().add( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(ProcessingInstruction processingInstruction) {
|
|
||||||
target().add( processingInstruction );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(Node node) {
|
|
||||||
return target().remove( node );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(Comment comment) {
|
|
||||||
return target().remove( comment );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(Element element) {
|
|
||||||
return target().remove( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove(ProcessingInstruction processingInstruction) {
|
|
||||||
return target().remove( processingInstruction );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void normalize() {
|
|
||||||
target().normalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Element target() {
|
|
||||||
return li.getElement();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
|
||||||
* indicated by the @author tags or express copyright attribution
|
|
||||||
* statements applied by the authors. All third-party contributions are
|
|
||||||
* distributed under license by Red Hat Inc.
|
|
||||||
*
|
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
|
||||||
* Lesser General Public License, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this distribution; if not, write to:
|
|
||||||
* Free Software Foundation, Inc.
|
|
||||||
* 51 Franklin Street, Fifth Floor
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package org.hibernate.proxy.dom4j;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
|
||||||
import org.hibernate.proxy.HibernateProxy;
|
|
||||||
import org.hibernate.proxy.ProxyFactory;
|
|
||||||
import org.hibernate.type.CompositeType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds proxies for "dom4j" entity representations.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public class Dom4jProxyFactory implements ProxyFactory {
|
|
||||||
|
|
||||||
private String entityName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called immediately after instantiation
|
|
||||||
*/
|
|
||||||
public void postInstantiate(
|
|
||||||
String entityName,
|
|
||||||
Class persistentClass,
|
|
||||||
Set interfaces,
|
|
||||||
Method getIdentifierMethod,
|
|
||||||
Method setIdentifierMethod,
|
|
||||||
CompositeType componentIdType) throws HibernateException {
|
|
||||||
this.entityName = entityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new proxy
|
|
||||||
*/
|
|
||||||
public HibernateProxy getProxy(Serializable id, SessionImplementor session) throws HibernateException {
|
|
||||||
return new Dom4jProxy( new Dom4jLazyInitializer( entityName, id, session ) );
|
|
||||||
}
|
|
||||||
}
|
|
@ -68,7 +68,6 @@ protected BasicLazyInitializer(
|
|||||||
|
|
||||||
protected abstract Object serializableProxy();
|
protected abstract Object serializableProxy();
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
protected final Object invoke(Method method, Object[] args, Object proxy) throws Throwable {
|
protected final Object invoke(Method method, Object[] args, Object proxy) throws Throwable {
|
||||||
String methodName = method.getName();
|
String methodName = method.getName();
|
||||||
int params = args.length;
|
int params = args.length;
|
||||||
@ -78,7 +77,7 @@ protected final Object invoke(Method method, Object[] args, Object proxy) throws
|
|||||||
return getReplacement();
|
return getReplacement();
|
||||||
}
|
}
|
||||||
else if ( !overridesEquals && "hashCode".equals(methodName) ) {
|
else if ( !overridesEquals && "hashCode".equals(methodName) ) {
|
||||||
return Integer.valueOf( System.identityHashCode(proxy) );
|
return System.identityHashCode(proxy);
|
||||||
}
|
}
|
||||||
else if ( isUninitialized() && method.equals(getIdentifierMethod) ) {
|
else if ( isUninitialized() && method.equals(getIdentifierMethod) ) {
|
||||||
return getIdentifier();
|
return getIdentifier();
|
||||||
|
@ -168,6 +168,7 @@ public static Class getProxyFactory(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object invoke(
|
public Object invoke(
|
||||||
final Object proxy,
|
final Object proxy,
|
||||||
final Method thisMethod,
|
final Method thisMethod,
|
||||||
|
@ -49,6 +49,7 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
|||||||
private CompositeType componentIdType;
|
private CompositeType componentIdType;
|
||||||
private Class factory;
|
private Class factory;
|
||||||
private boolean overridesEquals;
|
private boolean overridesEquals;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postInstantiate(
|
public void postInstantiate(
|
||||||
final String entityName,
|
final String entityName,
|
||||||
@ -66,6 +67,7 @@ public void postInstantiate(
|
|||||||
this.factory = JavassistLazyInitializer.getProxyFactory( persistentClass, this.interfaces );
|
this.factory = JavassistLazyInitializer.getProxyFactory( persistentClass, this.interfaces );
|
||||||
this.overridesEquals = ReflectHelper.overridesEquals(persistentClass);
|
this.overridesEquals = ReflectHelper.overridesEquals(persistentClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateProxy getProxy(
|
public HibernateProxy getProxy(
|
||||||
Serializable id,
|
Serializable id,
|
||||||
|
@ -406,9 +406,9 @@ public void naturalIdQueryExecuted(String regionName, long time) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
@Override
|
||||||
public void queryExecuted(String hql, int rows, long time) {
|
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();
|
queryExecutionCount.getAndIncrement();
|
||||||
boolean isLongestQuery = false;
|
boolean isLongestQuery = false;
|
||||||
for ( long old = queryExecutionMaxTime.get();
|
for ( long old = queryExecutionMaxTime.get();
|
||||||
@ -424,7 +424,7 @@ public void queryExecuted(String hql, int rows, long time) {
|
|||||||
qs.executed( rows, time );
|
qs.executed( rows, time );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void queryCacheHit(String hql, String regionName) {
|
public void queryCacheHit(String hql, String regionName) {
|
||||||
queryCacheHitCount.getAndIncrement();
|
queryCacheHitCount.getAndIncrement();
|
||||||
if ( hql != null ) {
|
if ( hql != null ) {
|
||||||
@ -436,7 +436,7 @@ public void queryCacheHit(String hql, String regionName) {
|
|||||||
);
|
);
|
||||||
slcs.incrementHitCount();
|
slcs.incrementHitCount();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void queryCacheMiss(String hql, String regionName) {
|
public void queryCacheMiss(String hql, String regionName) {
|
||||||
queryCacheMissCount.getAndIncrement();
|
queryCacheMissCount.getAndIncrement();
|
||||||
if ( hql != null ) {
|
if ( hql != null ) {
|
||||||
@ -448,7 +448,7 @@ public void queryCacheMiss(String hql, String regionName) {
|
|||||||
);
|
);
|
||||||
slcs.incrementMissCount();
|
slcs.incrementMissCount();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void queryCachePut(String hql, String regionName) {
|
public void queryCachePut(String hql, String regionName) {
|
||||||
queryCachePutCount.getAndIncrement();
|
queryCachePutCount.getAndIncrement();
|
||||||
if ( hql != null ) {
|
if ( hql != null ) {
|
||||||
@ -483,6 +483,7 @@ public void updateTimestampsCachePut() {
|
|||||||
*
|
*
|
||||||
* @return QueryStatistics
|
* @return QueryStatistics
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public QueryStatistics getQueryStatistics(String queryString) {
|
public QueryStatistics getQueryStatistics(String queryString) {
|
||||||
ConcurrentQueryStatisticsImpl qs = (ConcurrentQueryStatisticsImpl) queryStatistics.get( queryString );
|
ConcurrentQueryStatisticsImpl qs = (ConcurrentQueryStatisticsImpl) queryStatistics.get( queryString );
|
||||||
if ( qs == null ) {
|
if ( qs == null ) {
|
||||||
@ -500,6 +501,7 @@ public QueryStatistics getQueryStatistics(String queryString) {
|
|||||||
/**
|
/**
|
||||||
* @return entity deletion count
|
* @return entity deletion count
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getEntityDeleteCount() {
|
public long getEntityDeleteCount() {
|
||||||
return entityDeleteCount.get();
|
return entityDeleteCount.get();
|
||||||
}
|
}
|
||||||
@ -507,6 +509,7 @@ public long getEntityDeleteCount() {
|
|||||||
/**
|
/**
|
||||||
* @return entity insertion count
|
* @return entity insertion count
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getEntityInsertCount() {
|
public long getEntityInsertCount() {
|
||||||
return entityInsertCount.get();
|
return entityInsertCount.get();
|
||||||
}
|
}
|
||||||
@ -514,6 +517,7 @@ public long getEntityInsertCount() {
|
|||||||
/**
|
/**
|
||||||
* @return entity load (from DB)
|
* @return entity load (from DB)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getEntityLoadCount() {
|
public long getEntityLoadCount() {
|
||||||
return entityLoadCount.get();
|
return entityLoadCount.get();
|
||||||
}
|
}
|
||||||
@ -521,6 +525,7 @@ public long getEntityLoadCount() {
|
|||||||
/**
|
/**
|
||||||
* @return entity fetch (from DB)
|
* @return entity fetch (from DB)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getEntityFetchCount() {
|
public long getEntityFetchCount() {
|
||||||
return entityFetchCount.get();
|
return entityFetchCount.get();
|
||||||
}
|
}
|
||||||
@ -528,34 +533,35 @@ public long getEntityFetchCount() {
|
|||||||
/**
|
/**
|
||||||
* @return entity update
|
* @return entity update
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getEntityUpdateCount() {
|
public long getEntityUpdateCount() {
|
||||||
return entityUpdateCount.get();
|
return entityUpdateCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getQueryExecutionCount() {
|
public long getQueryExecutionCount() {
|
||||||
return queryExecutionCount.get();
|
return queryExecutionCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getQueryCacheHitCount() {
|
public long getQueryCacheHitCount() {
|
||||||
return queryCacheHitCount.get();
|
return queryCacheHitCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getQueryCacheMissCount() {
|
public long getQueryCacheMissCount() {
|
||||||
return queryCacheMissCount.get();
|
return queryCacheMissCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getQueryCachePutCount() {
|
public long getQueryCachePutCount() {
|
||||||
return queryCachePutCount.get();
|
return queryCachePutCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getUpdateTimestampsCacheHitCount() {
|
public long getUpdateTimestampsCacheHitCount() {
|
||||||
return updateTimestampsCacheHitCount.get();
|
return updateTimestampsCacheHitCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getUpdateTimestampsCacheMissCount() {
|
public long getUpdateTimestampsCacheMissCount() {
|
||||||
return updateTimestampsCacheMissCount.get();
|
return updateTimestampsCacheMissCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getUpdateTimestampsCachePutCount() {
|
public long getUpdateTimestampsCachePutCount() {
|
||||||
return updateTimestampsCachePutCount.get();
|
return updateTimestampsCachePutCount.get();
|
||||||
}
|
}
|
||||||
@ -563,6 +569,7 @@ public long getUpdateTimestampsCachePutCount() {
|
|||||||
/**
|
/**
|
||||||
* @return flush
|
* @return flush
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getFlushCount() {
|
public long getFlushCount() {
|
||||||
return flushCount.get();
|
return flushCount.get();
|
||||||
}
|
}
|
||||||
@ -570,6 +577,7 @@ public long getFlushCount() {
|
|||||||
/**
|
/**
|
||||||
* @return session connect
|
* @return session connect
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getConnectCount() {
|
public long getConnectCount() {
|
||||||
return connectCount.get();
|
return connectCount.get();
|
||||||
}
|
}
|
||||||
@ -577,6 +585,7 @@ public long getConnectCount() {
|
|||||||
/**
|
/**
|
||||||
* @return second level cache hit
|
* @return second level cache hit
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getSecondLevelCacheHitCount() {
|
public long getSecondLevelCacheHitCount() {
|
||||||
return secondLevelCacheHitCount.get();
|
return secondLevelCacheHitCount.get();
|
||||||
}
|
}
|
||||||
@ -584,6 +593,7 @@ public long getSecondLevelCacheHitCount() {
|
|||||||
/**
|
/**
|
||||||
* @return second level cache miss
|
* @return second level cache miss
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getSecondLevelCacheMissCount() {
|
public long getSecondLevelCacheMissCount() {
|
||||||
return secondLevelCacheMissCount.get();
|
return secondLevelCacheMissCount.get();
|
||||||
}
|
}
|
||||||
@ -591,6 +601,7 @@ public long getSecondLevelCacheMissCount() {
|
|||||||
/**
|
/**
|
||||||
* @return second level cache put
|
* @return second level cache put
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getSecondLevelCachePutCount() {
|
public long getSecondLevelCachePutCount() {
|
||||||
return secondLevelCachePutCount.get();
|
return secondLevelCachePutCount.get();
|
||||||
}
|
}
|
||||||
@ -628,6 +639,7 @@ public long getNaturalIdCachePutCount() {
|
|||||||
/**
|
/**
|
||||||
* @return session closing
|
* @return session closing
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getSessionCloseCount() {
|
public long getSessionCloseCount() {
|
||||||
return sessionCloseCount.get();
|
return sessionCloseCount.get();
|
||||||
}
|
}
|
||||||
@ -635,6 +647,7 @@ public long getSessionCloseCount() {
|
|||||||
/**
|
/**
|
||||||
* @return session opening
|
* @return session opening
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getSessionOpenCount() {
|
public long getSessionOpenCount() {
|
||||||
return sessionOpenCount.get();
|
return sessionOpenCount.get();
|
||||||
}
|
}
|
||||||
@ -642,6 +655,7 @@ public long getSessionOpenCount() {
|
|||||||
/**
|
/**
|
||||||
* @return collection loading (from DB)
|
* @return collection loading (from DB)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getCollectionLoadCount() {
|
public long getCollectionLoadCount() {
|
||||||
return collectionLoadCount.get();
|
return collectionLoadCount.get();
|
||||||
}
|
}
|
||||||
@ -649,6 +663,7 @@ public long getCollectionLoadCount() {
|
|||||||
/**
|
/**
|
||||||
* @return collection fetching (from DB)
|
* @return collection fetching (from DB)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getCollectionFetchCount() {
|
public long getCollectionFetchCount() {
|
||||||
return collectionFetchCount.get();
|
return collectionFetchCount.get();
|
||||||
}
|
}
|
||||||
@ -656,6 +671,7 @@ public long getCollectionFetchCount() {
|
|||||||
/**
|
/**
|
||||||
* @return collection update
|
* @return collection update
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getCollectionUpdateCount() {
|
public long getCollectionUpdateCount() {
|
||||||
return collectionUpdateCount.get();
|
return collectionUpdateCount.get();
|
||||||
}
|
}
|
||||||
@ -664,6 +680,7 @@ public long getCollectionUpdateCount() {
|
|||||||
* @return collection removal
|
* @return collection removal
|
||||||
* FIXME: even if isInverse="true"?
|
* FIXME: even if isInverse="true"?
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getCollectionRemoveCount() {
|
public long getCollectionRemoveCount() {
|
||||||
return collectionRemoveCount.get();
|
return collectionRemoveCount.get();
|
||||||
}
|
}
|
||||||
@ -671,6 +688,7 @@ public long getCollectionRemoveCount() {
|
|||||||
/**
|
/**
|
||||||
* @return collection recreation
|
* @return collection recreation
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getCollectionRecreateCount() {
|
public long getCollectionRecreateCount() {
|
||||||
return collectionRecreateCount.get();
|
return collectionRecreateCount.get();
|
||||||
}
|
}
|
||||||
@ -678,6 +696,7 @@ public long getCollectionRecreateCount() {
|
|||||||
/**
|
/**
|
||||||
* @return start time in ms (JVM standards {@link System#currentTimeMillis()})
|
* @return start time in ms (JVM standards {@link System#currentTimeMillis()})
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getStartTime() {
|
public long getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
@ -685,6 +704,7 @@ public long getStartTime() {
|
|||||||
/**
|
/**
|
||||||
* log in info level the main statistics
|
* log in info level the main statistics
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void logSummary() {
|
public void logSummary() {
|
||||||
LOG.loggingStatistics();
|
LOG.loggingStatistics();
|
||||||
LOG.startTime( startTime );
|
LOG.startTime( startTime );
|
||||||
@ -728,6 +748,7 @@ public void logSummary() {
|
|||||||
/**
|
/**
|
||||||
* Are statistics logged
|
* Are statistics logged
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isStatisticsEnabled() {
|
public boolean isStatisticsEnabled() {
|
||||||
return isStatisticsEnabled;
|
return isStatisticsEnabled;
|
||||||
}
|
}
|
||||||
@ -735,6 +756,7 @@ public boolean isStatisticsEnabled() {
|
|||||||
/**
|
/**
|
||||||
* Enable statistics logs (this is a dynamic parameter)
|
* Enable statistics logs (this is a dynamic parameter)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setStatisticsEnabled(boolean b) {
|
public void setStatisticsEnabled(boolean b) {
|
||||||
isStatisticsEnabled = b;
|
isStatisticsEnabled = b;
|
||||||
}
|
}
|
||||||
@ -743,6 +765,7 @@ public void setStatisticsEnabled(boolean b) {
|
|||||||
* @return Returns the max query execution time,
|
* @return Returns the max query execution time,
|
||||||
* for all queries
|
* for all queries
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getQueryExecutionMaxTime() {
|
public long getQueryExecutionMaxTime() {
|
||||||
return queryExecutionMaxTime.get();
|
return queryExecutionMaxTime.get();
|
||||||
}
|
}
|
||||||
@ -750,6 +773,7 @@ public long getQueryExecutionMaxTime() {
|
|||||||
/**
|
/**
|
||||||
* Get all executed query strings
|
* Get all executed query strings
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getQueries() {
|
public String[] getQueries() {
|
||||||
return ArrayHelper.toStringArray( queryStatistics.keySet() );
|
return ArrayHelper.toStringArray( queryStatistics.keySet() );
|
||||||
}
|
}
|
||||||
@ -757,6 +781,7 @@ public String[] getQueries() {
|
|||||||
/**
|
/**
|
||||||
* Get the names of all entities
|
* Get the names of all entities
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getEntityNames() {
|
public String[] getEntityNames() {
|
||||||
if ( sessionFactory == null ) {
|
if ( sessionFactory == null ) {
|
||||||
return ArrayHelper.toStringArray( entityStatistics.keySet() );
|
return ArrayHelper.toStringArray( entityStatistics.keySet() );
|
||||||
@ -769,6 +794,7 @@ public String[] getEntityNames() {
|
|||||||
/**
|
/**
|
||||||
* Get the names of all collection roles
|
* Get the names of all collection roles
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getCollectionRoleNames() {
|
public String[] getCollectionRoleNames() {
|
||||||
if ( sessionFactory == null ) {
|
if ( sessionFactory == null ) {
|
||||||
return ArrayHelper.toStringArray( collectionStatistics.keySet() );
|
return ArrayHelper.toStringArray( collectionStatistics.keySet() );
|
||||||
@ -781,6 +807,7 @@ public String[] getCollectionRoleNames() {
|
|||||||
/**
|
/**
|
||||||
* Get all second-level cache region names
|
* Get all second-level cache region names
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getSecondLevelCacheRegionNames() {
|
public String[] getSecondLevelCacheRegionNames() {
|
||||||
if ( sessionFactory == null ) {
|
if ( sessionFactory == null ) {
|
||||||
return ArrayHelper.toStringArray( secondLevelCacheStatistics.keySet() );
|
return ArrayHelper.toStringArray( secondLevelCacheStatistics.keySet() );
|
||||||
@ -789,43 +816,43 @@ public String[] getSecondLevelCacheRegionNames() {
|
|||||||
return ArrayHelper.toStringArray( sessionFactory.getAllSecondLevelCacheRegions().keySet() );
|
return ArrayHelper.toStringArray( sessionFactory.getAllSecondLevelCacheRegions().keySet() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void endTransaction(boolean success) {
|
public void endTransaction(boolean success) {
|
||||||
transactionCount.getAndIncrement();
|
transactionCount.getAndIncrement();
|
||||||
if ( success ) {
|
if ( success ) {
|
||||||
committedTransactionCount.getAndIncrement();
|
committedTransactionCount.getAndIncrement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getSuccessfulTransactionCount() {
|
public long getSuccessfulTransactionCount() {
|
||||||
return committedTransactionCount.get();
|
return committedTransactionCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getTransactionCount() {
|
public long getTransactionCount() {
|
||||||
return transactionCount.get();
|
return transactionCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void closeStatement() {
|
public void closeStatement() {
|
||||||
closeStatementCount.getAndIncrement();
|
closeStatementCount.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void prepareStatement() {
|
public void prepareStatement() {
|
||||||
prepareStatementCount.getAndIncrement();
|
prepareStatementCount.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getCloseStatementCount() {
|
public long getCloseStatementCount() {
|
||||||
return closeStatementCount.get();
|
return closeStatementCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getPrepareStatementCount() {
|
public long getPrepareStatementCount() {
|
||||||
return prepareStatementCount.get();
|
return prepareStatementCount.get();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void optimisticFailure(String entityName) {
|
public void optimisticFailure(String entityName) {
|
||||||
optimisticFailureCount.getAndIncrement();
|
optimisticFailureCount.getAndIncrement();
|
||||||
( (ConcurrentEntityStatisticsImpl) getEntityStatistics( entityName ) ).incrementOptimisticFailureCount();
|
( (ConcurrentEntityStatisticsImpl) getEntityStatistics( entityName ) ).incrementOptimisticFailureCount();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public long getOptimisticFailureCount() {
|
public long getOptimisticFailureCount() {
|
||||||
return optimisticFailureCount.get();
|
return optimisticFailureCount.get();
|
||||||
}
|
}
|
||||||
@ -873,7 +900,7 @@ public String toString() {
|
|||||||
.append( ']' )
|
.append( ']' )
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getQueryExecutionMaxTimeQueryString() {
|
public String getQueryExecutionMaxTimeQueryString() {
|
||||||
return queryExecutionMaxTimeQueryString;
|
return queryExecutionMaxTimeQueryString;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ private void processClassFile(File javaClassFile) {
|
|||||||
|
|
||||||
private boolean shouldInclude(CtClass ctClass) {
|
private boolean shouldInclude(CtClass ctClass) {
|
||||||
// we currently only handle entity enhancement
|
// we currently only handle entity enhancement
|
||||||
return ! ctClass.hasAnnotation( Entity.class );
|
return ctClass.hasAnnotation( Entity.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,8 +158,14 @@ public PojoEntityTuplizer(EntityMetamodel entityMetamodel, EntityBinding mappedE
|
|||||||
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
|
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
|
||||||
// determine the id getter and setter methods from the proxy interface (if any)
|
// determine the id getter and setter methods from the proxy interface (if any)
|
||||||
// determine all interfaces needed by the resulting proxy
|
// determine all interfaces needed by the resulting proxy
|
||||||
HashSet<Class> proxyInterfaces = new HashSet<Class>();
|
|
||||||
proxyInterfaces.add( HibernateProxy.class );
|
/*
|
||||||
|
* We need to preserve the order of the interfaces they were put into the set, since javassist will choose the
|
||||||
|
* first one's class-loader to construct the proxy class with. This is also the reason why HibernateProxy.class
|
||||||
|
* should be the last one in the order (on JBossAS7 its class-loader will be org.hibernate module's class-
|
||||||
|
* loader, which will not see the classes inside deployed apps. See HHH-3078
|
||||||
|
*/
|
||||||
|
Set<Class> proxyInterfaces = new java.util.LinkedHashSet<Class>();
|
||||||
|
|
||||||
Class mappedClass = persistentClass.getMappedClass();
|
Class mappedClass = persistentClass.getMappedClass();
|
||||||
Class proxyInterface = persistentClass.getProxyInterface();
|
Class proxyInterface = persistentClass.getProxyInterface();
|
||||||
@ -192,6 +198,8 @@ protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proxyInterfaces.add( HibernateProxy.class );
|
||||||
|
|
||||||
Iterator properties = persistentClass.getPropertyIterator();
|
Iterator properties = persistentClass.getPropertyIterator();
|
||||||
Class clazz = persistentClass.getMappedClass();
|
Class clazz = persistentClass.getMappedClass();
|
||||||
while ( properties.hasNext() ) {
|
while ( properties.hasNext() ) {
|
||||||
|
@ -47,7 +47,7 @@ public BooleanType() {
|
|||||||
protected BooleanType(SqlTypeDescriptor sqlTypeDescriptor, BooleanTypeDescriptor javaTypeDescriptor) {
|
protected BooleanType(SqlTypeDescriptor sqlTypeDescriptor, BooleanTypeDescriptor javaTypeDescriptor) {
|
||||||
super( sqlTypeDescriptor, javaTypeDescriptor );
|
super( sqlTypeDescriptor, javaTypeDescriptor );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "boolean";
|
return "boolean";
|
||||||
}
|
}
|
||||||
@ -56,22 +56,22 @@ public String getName() {
|
|||||||
public String[] getRegistrationKeys() {
|
public String[] getRegistrationKeys() {
|
||||||
return new String[] { getName(), boolean.class.getName(), Boolean.class.getName() };
|
return new String[] { getName(), boolean.class.getName(), Boolean.class.getName() };
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return boolean.class;
|
return boolean.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Boolean stringToObject(String string) {
|
public Boolean stringToObject(String string) {
|
||||||
return fromString( string );
|
return fromString( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
@Override
|
||||||
public String objectToSQLString(Boolean value, Dialect dialect) {
|
public String objectToSQLString(Boolean value, Dialect dialect) {
|
||||||
return dialect.toBooleanValueString( value.booleanValue() );
|
return dialect.toBooleanValueString( value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,19 +37,18 @@
|
|||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public class ByteType
|
public class ByteType
|
||||||
extends AbstractSingleColumnStandardBasicType<Byte>
|
extends AbstractSingleColumnStandardBasicType<Byte>
|
||||||
implements PrimitiveType<Byte>, DiscriminatorType<Byte>, VersionType<Byte> {
|
implements PrimitiveType<Byte>, DiscriminatorType<Byte>, VersionType<Byte> {
|
||||||
|
|
||||||
public static final ByteType INSTANCE = new ByteType();
|
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() {
|
public ByteType() {
|
||||||
super( TinyIntTypeDescriptor.INSTANCE, ByteTypeDescriptor.INSTANCE );
|
super( TinyIntTypeDescriptor.INSTANCE, ByteTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "byte";
|
return "byte";
|
||||||
}
|
}
|
||||||
@ -58,36 +57,35 @@ public String getName() {
|
|||||||
public String[] getRegistrationKeys() {
|
public String[] getRegistrationKeys() {
|
||||||
return new String[] { getName(), byte.class.getName(), Byte.class.getName() };
|
return new String[] { getName(), byte.class.getName(), Byte.class.getName() };
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return byte.class;
|
return byte.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String objectToSQLString(Byte value, Dialect dialect) {
|
public String objectToSQLString(Byte value, Dialect dialect) {
|
||||||
return toString( value );
|
return toString( value );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Byte stringToObject(String xml) {
|
public Byte stringToObject(String xml) {
|
||||||
return fromString( xml );
|
return fromString( xml );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Byte fromStringValue(String xml) {
|
public Byte fromStringValue(String xml) {
|
||||||
return fromString( xml );
|
return fromString( xml );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public Byte next(Byte current, SessionImplementor session) {
|
public Byte next(Byte current, SessionImplementor session) {
|
||||||
return Byte.valueOf( (byte) ( current.byteValue() + 1 ) );
|
return (byte) ( current + 1 );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Byte seed(SessionImplementor session) {
|
public Byte seed(SessionImplementor session) {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Comparator<Byte> getComparator() {
|
public Comparator<Byte> getComparator() {
|
||||||
return getJavaTypeDescriptor().getComparator();
|
return getJavaTypeDescriptor().getComparator();
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,12 @@
|
|||||||
public class DoubleType extends AbstractSingleColumnStandardBasicType<Double> implements PrimitiveType<Double> {
|
public class DoubleType extends AbstractSingleColumnStandardBasicType<Double> implements PrimitiveType<Double> {
|
||||||
public static final DoubleType INSTANCE = new DoubleType();
|
public static final DoubleType INSTANCE = new DoubleType();
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
public static final Double ZERO = 0.0;
|
||||||
public static final Double ZERO = Double.valueOf( 0.0 );
|
|
||||||
|
|
||||||
public DoubleType() {
|
public DoubleType() {
|
||||||
super( org.hibernate.type.descriptor.sql.DoubleTypeDescriptor.INSTANCE, DoubleTypeDescriptor.INSTANCE );
|
super( org.hibernate.type.descriptor.sql.DoubleTypeDescriptor.INSTANCE, DoubleTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "double";
|
return "double";
|
||||||
}
|
}
|
||||||
@ -52,15 +51,15 @@ public String getName() {
|
|||||||
public String[] getRegistrationKeys() {
|
public String[] getRegistrationKeys() {
|
||||||
return new String[] { getName(), double.class.getName(), Double.class.getName() };
|
return new String[] { getName(), double.class.getName(), Double.class.getName() };
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return double.class;
|
return double.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String objectToSQLString(Double value, Dialect dialect) throws Exception {
|
public String objectToSQLString(Double value, Dialect dialect) throws Exception {
|
||||||
return toString( value );
|
return toString( value );
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,12 @@
|
|||||||
public class FloatType extends AbstractSingleColumnStandardBasicType<Float> implements PrimitiveType<Float> {
|
public class FloatType extends AbstractSingleColumnStandardBasicType<Float> implements PrimitiveType<Float> {
|
||||||
public static final FloatType INSTANCE = new FloatType();
|
public static final FloatType INSTANCE = new FloatType();
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
public static final Float ZERO = 0.0f;
|
||||||
public static final Float ZERO = Float.valueOf( 0.0f );
|
|
||||||
|
|
||||||
public FloatType() {
|
public FloatType() {
|
||||||
super( org.hibernate.type.descriptor.sql.FloatTypeDescriptor.INSTANCE, FloatTypeDescriptor.INSTANCE );
|
super( org.hibernate.type.descriptor.sql.FloatTypeDescriptor.INSTANCE, FloatTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "float";
|
return "float";
|
||||||
}
|
}
|
||||||
@ -52,15 +51,15 @@ public String getName() {
|
|||||||
public String[] getRegistrationKeys() {
|
public String[] getRegistrationKeys() {
|
||||||
return new String[] { getName(), float.class.getName(), Float.class.getName() };
|
return new String[] { getName(), float.class.getName(), Float.class.getName() };
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return float.class;
|
return float.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String objectToSQLString(Float value, Dialect dialect) throws Exception {
|
public String objectToSQLString(Float value, Dialect dialect) throws Exception {
|
||||||
return toString( value );
|
return toString( value );
|
||||||
}
|
}
|
||||||
|
@ -41,13 +41,12 @@ public class IntegerType extends AbstractSingleColumnStandardBasicType<Integer>
|
|||||||
|
|
||||||
public static final IntegerType INSTANCE = new IntegerType();
|
public static final IntegerType INSTANCE = new IntegerType();
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
public static final Integer ZERO = 0;
|
||||||
public static final Integer ZERO = Integer.valueOf( 0 );
|
|
||||||
|
|
||||||
public IntegerType() {
|
public IntegerType() {
|
||||||
super( org.hibernate.type.descriptor.sql.IntegerTypeDescriptor.INSTANCE, IntegerTypeDescriptor.INSTANCE );
|
super( org.hibernate.type.descriptor.sql.IntegerTypeDescriptor.INSTANCE, IntegerTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "integer";
|
return "integer";
|
||||||
}
|
}
|
||||||
@ -56,32 +55,31 @@ public String getName() {
|
|||||||
public String[] getRegistrationKeys() {
|
public String[] getRegistrationKeys() {
|
||||||
return new String[] { getName(), int.class.getName(), Integer.class.getName() };
|
return new String[] { getName(), int.class.getName(), Integer.class.getName() };
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return int.class;
|
return int.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String objectToSQLString(Integer value, Dialect dialect) throws Exception {
|
public String objectToSQLString(Integer value, Dialect dialect) throws Exception {
|
||||||
return toString( value );
|
return toString( value );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Integer stringToObject(String xml) {
|
public Integer stringToObject(String xml) {
|
||||||
return fromString( xml );
|
return fromString( xml );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Integer seed(SessionImplementor session) {
|
public Integer seed(SessionImplementor session) {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
|
||||||
public Integer next(Integer current, SessionImplementor session) {
|
public Integer next(Integer current, SessionImplementor session) {
|
||||||
return current+1;
|
return current+1;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Comparator<Integer> getComparator() {
|
public Comparator<Integer> getComparator() {
|
||||||
return getJavaTypeDescriptor().getComparator();
|
return getJavaTypeDescriptor().getComparator();
|
||||||
}
|
}
|
||||||
|
@ -43,13 +43,12 @@ public class LongType
|
|||||||
|
|
||||||
public static final LongType INSTANCE = new LongType();
|
public static final LongType INSTANCE = new LongType();
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
private static final Long ZERO = (long) 0;
|
||||||
private static final Long ZERO = Long.valueOf( 0 );
|
|
||||||
|
|
||||||
public LongType() {
|
public LongType() {
|
||||||
super( BigIntTypeDescriptor.INSTANCE, LongTypeDescriptor.INSTANCE );
|
super( BigIntTypeDescriptor.INSTANCE, LongTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "long";
|
return "long";
|
||||||
}
|
}
|
||||||
@ -58,32 +57,31 @@ public String getName() {
|
|||||||
public String[] getRegistrationKeys() {
|
public String[] getRegistrationKeys() {
|
||||||
return new String[] { getName(), long.class.getName(), Long.class.getName() };
|
return new String[] { getName(), long.class.getName(), Long.class.getName() };
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return long.class;
|
return long.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Long stringToObject(String xml) throws Exception {
|
public Long stringToObject(String xml) throws Exception {
|
||||||
return Long.valueOf( xml );
|
return Long.valueOf( xml );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
|
||||||
public Long next(Long current, SessionImplementor session) {
|
public Long next(Long current, SessionImplementor session) {
|
||||||
return current + 1l;
|
return current + 1l;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Long seed(SessionImplementor session) {
|
public Long seed(SessionImplementor session) {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Comparator<Long> getComparator() {
|
public Comparator<Long> getComparator() {
|
||||||
return getJavaTypeDescriptor().getComparator();
|
return getJavaTypeDescriptor().getComparator();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String objectToSQLString(Long value, Dialect dialect) throws Exception {
|
public String objectToSQLString(Long value, Dialect dialect) throws Exception {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
@ -43,25 +43,24 @@ public class NumericBooleanType
|
|||||||
public NumericBooleanType() {
|
public NumericBooleanType() {
|
||||||
super( IntegerTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE );
|
super( IntegerTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "numeric_boolean";
|
return "numeric_boolean";
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return boolean.class;
|
return boolean.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Boolean stringToObject(String string) {
|
public Boolean stringToObject(String string) {
|
||||||
return fromString( string );
|
return fromString( string );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public String objectToSQLString(Boolean value, Dialect dialect) {
|
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();
|
public static final ShortType INSTANCE = new ShortType();
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
private static final Short ZERO = (short) 0;
|
||||||
private static final Short ZERO = Short.valueOf( (short) 0 );
|
|
||||||
|
|
||||||
public ShortType() {
|
public ShortType() {
|
||||||
super( SmallIntTypeDescriptor.INSTANCE, ShortTypeDescriptor.INSTANCE );
|
super( SmallIntTypeDescriptor.INSTANCE, ShortTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "short";
|
return "short";
|
||||||
}
|
}
|
||||||
@ -58,32 +57,31 @@ public String getName() {
|
|||||||
public String[] getRegistrationKeys() {
|
public String[] getRegistrationKeys() {
|
||||||
return new String[] { getName(), short.class.getName(), Short.class.getName() };
|
return new String[] { getName(), short.class.getName(), Short.class.getName() };
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return short.class;
|
return short.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String objectToSQLString(Short value, Dialect dialect) throws Exception {
|
public String objectToSQLString(Short value, Dialect dialect) throws Exception {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Short stringToObject(String xml) throws Exception {
|
public Short stringToObject(String xml) throws Exception {
|
||||||
return Short.valueOf( xml );
|
return Short.valueOf( xml );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
|
|
||||||
public Short next(Short current, SessionImplementor session) {
|
public Short next(Short current, SessionImplementor session) {
|
||||||
return Short.valueOf( (short) ( current.shortValue() + 1 ) );
|
return (short) ( current + 1 );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Short seed(SessionImplementor session) {
|
public Short seed(SessionImplementor session) {
|
||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Comparator<Short> getComparator() {
|
public Comparator<Short> getComparator() {
|
||||||
return getJavaTypeDescriptor().getComparator();
|
return getJavaTypeDescriptor().getComparator();
|
||||||
}
|
}
|
||||||
|
@ -44,26 +44,25 @@ public class TrueFalseType
|
|||||||
public TrueFalseType() {
|
public TrueFalseType() {
|
||||||
super( CharTypeDescriptor.INSTANCE, new BooleanTypeDescriptor( 'T', 'F' ) );
|
super( CharTypeDescriptor.INSTANCE, new BooleanTypeDescriptor( 'T', 'F' ) );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "true_false";
|
return "true_false";
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return boolean.class;
|
return boolean.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Boolean stringToObject(String xml) throws Exception {
|
public Boolean stringToObject(String xml) throws Exception {
|
||||||
return fromString( xml );
|
return fromString( xml );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public String objectToSQLString(Boolean value, Dialect dialect) throws Exception {
|
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() {
|
public YesNoType() {
|
||||||
super( CharTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE );
|
super( CharTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "yes_no";
|
return "yes_no";
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Class getPrimitiveClass() {
|
public Class getPrimitiveClass() {
|
||||||
return boolean.class;
|
return boolean.class;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Boolean stringToObject(String xml) throws Exception {
|
public Boolean stringToObject(String xml) throws Exception {
|
||||||
return fromString( xml );
|
return fromString( xml );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Serializable getDefaultValue() {
|
public Serializable getDefaultValue() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public String objectToSQLString(Boolean value, Dialect dialect) throws Exception {
|
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 BooleanTypeDescriptor(char characterValueTrue, char characterValueFalse)
|
|||||||
stringValueTrue = String.valueOf( characterValueTrue );
|
stringValueTrue = String.valueOf( characterValueTrue );
|
||||||
stringValueFalse = String.valueOf( characterValueFalse );
|
stringValueFalse = String.valueOf( characterValueFalse );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Boolean value) {
|
public String toString(Boolean value) {
|
||||||
return value == null ? null : value.toString();
|
return value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Boolean fromString(String string) {
|
public Boolean fromString(String string) {
|
||||||
return Boolean.valueOf( string );
|
return Boolean.valueOf( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Boolean value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Boolean value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -95,8 +96,7 @@ public <X> X unwrap(Boolean value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public <X> Boolean wrap(X value, WrapperOptions options) {
|
public <X> Boolean wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -109,7 +109,7 @@ public <X> Boolean wrap(X value, WrapperOptions options) {
|
|||||||
return intValue == 0 ? FALSE : TRUE;
|
return intValue == 0 ? FALSE : TRUE;
|
||||||
}
|
}
|
||||||
if ( Character.class.isInstance( value ) ) {
|
if ( Character.class.isInstance( value ) ) {
|
||||||
return isTrue( ( (Character) value ).charValue() ) ? TRUE : FALSE;
|
return isTrue( (Character) value ) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
if ( String.class.isInstance( value ) ) {
|
if ( String.class.isInstance( value ) ) {
|
||||||
return isTrue( ( (String) value ).charAt( 0 ) ) ? TRUE : FALSE;
|
return isTrue( ( (String) value ).charAt( 0 ) ) ? TRUE : FALSE;
|
||||||
@ -125,23 +125,19 @@ public int toInt(Boolean value) {
|
|||||||
return value ? 1 : 0;
|
return value ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Byte toByte(Boolean value) {
|
public Byte toByte(Boolean value) {
|
||||||
return Byte.valueOf( (byte) toInt( value ) );
|
return (byte) toInt( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Short toShort(Boolean value) {
|
public Short toShort(Boolean value) {
|
||||||
return Short.valueOf( (short ) toInt( value ) );
|
return (short) toInt( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Integer toInteger(Boolean value) {
|
public Integer toInteger(Boolean value) {
|
||||||
return Integer.valueOf( toInt( value ) );
|
return toInt( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Long toLong(Boolean value) {
|
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() {
|
public ByteArrayTypeDescriptor() {
|
||||||
super( Byte[].class, ArrayMutabilityPlan.INSTANCE );
|
super( Byte[].class, ArrayMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public String toString(Byte[] bytes) {
|
public String toString(Byte[] bytes) {
|
||||||
final StringBuilder buf = new StringBuilder();
|
final StringBuilder buf = new StringBuilder();
|
||||||
for ( Byte aByte : bytes ) {
|
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 ) {
|
if ( hexStr.length() == 1 ) {
|
||||||
buf.append( '0' );
|
buf.append( '0' );
|
||||||
}
|
}
|
||||||
@ -58,8 +57,7 @@ public String toString(Byte[] bytes) {
|
|||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Byte[] fromString(String string) {
|
public Byte[] fromString(String string) {
|
||||||
if ( string == null ) {
|
if ( string == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -70,12 +68,13 @@ public Byte[] fromString(String string) {
|
|||||||
Byte[] bytes = new Byte[string.length() / 2];
|
Byte[] bytes = new Byte[string.length() / 2];
|
||||||
for ( int i = 0; i < bytes.length; i++ ) {
|
for ( int i = 0; i < bytes.length; i++ ) {
|
||||||
final String hexStr = string.substring( i * 2, (i + 1) * 2 );
|
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;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Byte[] value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Byte[] value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -98,7 +97,7 @@ public <X> X unwrap(Byte[] value, Class<X> type, WrapperOptions options) {
|
|||||||
|
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public <X> Byte[] wrap(X value, WrapperOptions options) {
|
public <X> Byte[] wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -124,26 +123,24 @@ public <X> Byte[] wrap(X value, WrapperOptions options) {
|
|||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
private Byte[] wrapBytes(byte[] bytes) {
|
private Byte[] wrapBytes(byte[] bytes) {
|
||||||
if ( bytes == null ) {
|
if ( bytes == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Byte[] result = new Byte[bytes.length];
|
final Byte[] result = new Byte[bytes.length];
|
||||||
for ( int i = 0; i < bytes.length; i++ ) {
|
for ( int i = 0; i < bytes.length; i++ ) {
|
||||||
result[i] = Byte.valueOf( bytes[i] );
|
result[i] = bytes[i];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
private byte[] unwrapBytes(Byte[] bytes) {
|
private byte[] unwrapBytes(Byte[] bytes) {
|
||||||
if ( bytes == null ) {
|
if ( bytes == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final byte[] result = new byte[bytes.length];
|
final byte[] result = new byte[bytes.length];
|
||||||
for ( int i = 0; i < bytes.length; i++ ) {
|
for ( int i = 0; i < bytes.length; i++ ) {
|
||||||
result[i] = bytes[i].byteValue();
|
result[i] = bytes[i];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -37,15 +37,17 @@ public ByteTypeDescriptor() {
|
|||||||
super( Byte.class );
|
super( Byte.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString(Byte value) {
|
public String toString(Byte value) {
|
||||||
return value == null ? null : value.toString();
|
return value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Byte fromString(String string) {
|
public Byte fromString(String string) {
|
||||||
return Byte.valueOf( string );
|
return Byte.valueOf( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Byte value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Byte value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -73,8 +75,7 @@ public <X> X unwrap(Byte value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public <X> Byte wrap(X value, WrapperOptions options) {
|
public <X> Byte wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -83,7 +84,7 @@ public <X> Byte wrap(X value, WrapperOptions options) {
|
|||||||
return (Byte) value;
|
return (Byte) value;
|
||||||
}
|
}
|
||||||
if ( Number.class.isInstance( value ) ) {
|
if ( Number.class.isInstance( value ) ) {
|
||||||
return Byte.valueOf( ( (Number) value ).byteValue() );
|
return ( (Number) value ).byteValue();
|
||||||
}
|
}
|
||||||
if ( String.class.isInstance( value ) ) {
|
if ( String.class.isInstance( value ) ) {
|
||||||
return Byte.valueOf( ( (String) value ) );
|
return Byte.valueOf( ( (String) value ) );
|
||||||
|
@ -44,11 +44,11 @@ public class CharacterArrayTypeDescriptor extends AbstractTypeDescriptor<Charact
|
|||||||
public CharacterArrayTypeDescriptor() {
|
public CharacterArrayTypeDescriptor() {
|
||||||
super( Character[].class, ArrayMutabilityPlan.INSTANCE );
|
super( Character[].class, ArrayMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Character[] value) {
|
public String toString(Character[] value) {
|
||||||
return new String( unwrapChars( value ) );
|
return new String( unwrapChars( value ) );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Character[] fromString(String string) {
|
public Character[] fromString(String string) {
|
||||||
return wrapChars( string.toCharArray() );
|
return wrapChars( string.toCharArray() );
|
||||||
}
|
}
|
||||||
@ -69,6 +69,7 @@ public int extractHashCode(Character[] chars) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Character[] value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Character[] value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -90,7 +91,7 @@ public <X> X unwrap(Character[] value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public <X> Character[] wrap(X value, WrapperOptions options) {
|
public <X> Character[] wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -110,26 +111,24 @@ public <X> Character[] wrap(X value, WrapperOptions options) {
|
|||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
private Character[] wrapChars(char[] chars) {
|
private Character[] wrapChars(char[] chars) {
|
||||||
if ( chars == null ) {
|
if ( chars == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Character[] result = new Character[chars.length];
|
final Character[] result = new Character[chars.length];
|
||||||
for ( int i = 0; i < chars.length; i++ ) {
|
for ( int i = 0; i < chars.length; i++ ) {
|
||||||
result[i] = Character.valueOf( chars[i] );
|
result[i] = chars[i];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
private char[] unwrapChars(Character[] chars) {
|
private char[] unwrapChars(Character[] chars) {
|
||||||
if ( chars == null ) {
|
if ( chars == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final char[] result = new char[chars.length];
|
final char[] result = new char[chars.length];
|
||||||
for ( int i = 0; i < chars.length; i++ ) {
|
for ( int i = 0; i < chars.length; i++ ) {
|
||||||
result[i] = chars[i].charValue();
|
result[i] = chars[i];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -36,20 +36,20 @@ public class CharacterTypeDescriptor extends AbstractTypeDescriptor<Character> {
|
|||||||
public CharacterTypeDescriptor() {
|
public CharacterTypeDescriptor() {
|
||||||
super( Character.class );
|
super( Character.class );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Character value) {
|
public String toString(Character value) {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public Character fromString(String string) {
|
public Character fromString(String string) {
|
||||||
if ( string.length() != 1 ) {
|
if ( string.length() != 1 ) {
|
||||||
throw new HibernateException( "multiple or zero characters found parsing string" );
|
throw new HibernateException( "multiple or zero characters found parsing string" );
|
||||||
}
|
}
|
||||||
return Character.valueOf( string.charAt( 0 ) );
|
return string.charAt( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Character value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Character value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -65,8 +65,7 @@ public <X> X unwrap(Character value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public <X> Character wrap(X value, WrapperOptions options) {
|
public <X> Character wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -76,11 +75,11 @@ public <X> Character wrap(X value, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
if ( String.class.isInstance( value ) ) {
|
if ( String.class.isInstance( value ) ) {
|
||||||
final String str = (String) value;
|
final String str = (String) value;
|
||||||
return Character.valueOf( str.charAt(0) );
|
return str.charAt( 0 );
|
||||||
}
|
}
|
||||||
if ( Number.class.isInstance( value ) ) {
|
if ( Number.class.isInstance( value ) ) {
|
||||||
final Number nbr = (Number) value;
|
final Number nbr = (Number) value;
|
||||||
return Character.valueOf( (char)nbr.shortValue() );
|
return (char) nbr.shortValue();
|
||||||
}
|
}
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class DateTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||||||
|
|
||||||
public static class DateMutabilityPlan extends MutableMutabilityPlan<Date> {
|
public static class DateMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||||
public static final DateMutabilityPlan INSTANCE = new DateMutabilityPlan();
|
public static final DateMutabilityPlan INSTANCE = new DateMutabilityPlan();
|
||||||
|
@Override
|
||||||
public Date deepCopyNotNull(Date value) {
|
public Date deepCopyNotNull(Date value) {
|
||||||
return new Date( value.getTime() );
|
return new Date( value.getTime() );
|
||||||
}
|
}
|
||||||
@ -52,11 +52,11 @@ public Date deepCopyNotNull(Date value) {
|
|||||||
public DateTypeDescriptor() {
|
public DateTypeDescriptor() {
|
||||||
super( Date.class, DateMutabilityPlan.INSTANCE );
|
super( Date.class, DateMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Date value) {
|
public String toString(Date value) {
|
||||||
return new SimpleDateFormat( DATE_FORMAT ).format( value );
|
return new SimpleDateFormat( DATE_FORMAT ).format( value );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Date fromString(String string) {
|
public Date fromString(String string) {
|
||||||
try {
|
try {
|
||||||
return new SimpleDateFormat(DATE_FORMAT).parse( string );
|
return new SimpleDateFormat(DATE_FORMAT).parse( string );
|
||||||
@ -71,11 +71,8 @@ public boolean areEqual(Date one, Date another) {
|
|||||||
if ( one == another) {
|
if ( one == another) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ( one == null || another == null ) {
|
return !( one == null || another == null ) && one.getTime() == another.getTime();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return one.getTime() == another.getTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,6 +83,7 @@ public int extractHashCode(Date value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -121,8 +119,7 @@ public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public <X> Date wrap(X value, WrapperOptions options) {
|
public <X> Date wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -132,7 +129,7 @@ public <X> Date wrap(X value, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( Long.class.isInstance( value ) ) {
|
if ( Long.class.isInstance( value ) ) {
|
||||||
return new Date( ( (Long) value ).longValue() );
|
return new Date( (Long) value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Calendar.class.isInstance( value ) ) {
|
if ( Calendar.class.isInstance( value ) ) {
|
||||||
|
@ -39,16 +39,17 @@ public class DoubleTypeDescriptor extends AbstractTypeDescriptor<Double> {
|
|||||||
public DoubleTypeDescriptor() {
|
public DoubleTypeDescriptor() {
|
||||||
super( Double.class );
|
super( Double.class );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Double value) {
|
public String toString(Double value) {
|
||||||
return value == null ? null : value.toString();
|
return value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Double fromString(String string) {
|
public Double fromString(String string) {
|
||||||
return Double.valueOf( string );
|
return Double.valueOf( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Double value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Double value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -82,8 +83,7 @@ public <X> X unwrap(Double value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public <X> Double wrap(X value, WrapperOptions options) {
|
public <X> Double wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -92,7 +92,7 @@ public <X> Double wrap(X value, WrapperOptions options) {
|
|||||||
return (Double) value;
|
return (Double) value;
|
||||||
}
|
}
|
||||||
if ( Number.class.isInstance( value ) ) {
|
if ( Number.class.isInstance( value ) ) {
|
||||||
return Double.valueOf( ( (Number) value ).doubleValue() );
|
return ( (Number) value ).doubleValue();
|
||||||
}
|
}
|
||||||
else if ( String.class.isInstance( value ) ) {
|
else if ( String.class.isInstance( value ) ) {
|
||||||
return Double.valueOf( ( (String) value ) );
|
return Double.valueOf( ( (String) value ) );
|
||||||
|
@ -39,16 +39,17 @@ public class FloatTypeDescriptor extends AbstractTypeDescriptor<Float> {
|
|||||||
public FloatTypeDescriptor() {
|
public FloatTypeDescriptor() {
|
||||||
super( Float.class );
|
super( Float.class );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Float value) {
|
public String toString(Float value) {
|
||||||
return value == null ? null : value.toString();
|
return value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Float fromString(String string) {
|
public Float fromString(String string) {
|
||||||
return Float.valueOf( string );
|
return Float.valueOf( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Float value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Float value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -82,8 +83,7 @@ public <X> X unwrap(Float value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public <X> Float wrap(X value, WrapperOptions options) {
|
public <X> Float wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -92,7 +92,7 @@ public <X> Float wrap(X value, WrapperOptions options) {
|
|||||||
return (Float) value;
|
return (Float) value;
|
||||||
}
|
}
|
||||||
if ( Number.class.isInstance( value ) ) {
|
if ( Number.class.isInstance( value ) ) {
|
||||||
return Float.valueOf( ( (Number) value ).floatValue() );
|
return ( (Number) value ).floatValue();
|
||||||
}
|
}
|
||||||
else if ( String.class.isInstance( value ) ) {
|
else if ( String.class.isInstance( value ) ) {
|
||||||
return Float.valueOf( ( (String) value ) );
|
return Float.valueOf( ( (String) value ) );
|
||||||
|
@ -39,16 +39,17 @@ public class IntegerTypeDescriptor extends AbstractTypeDescriptor<Integer> {
|
|||||||
public IntegerTypeDescriptor() {
|
public IntegerTypeDescriptor() {
|
||||||
super( Integer.class );
|
super( Integer.class );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Integer value) {
|
public String toString(Integer value) {
|
||||||
return value == null ? null : value.toString();
|
return value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Integer fromString(String string) {
|
public Integer fromString(String string) {
|
||||||
return string == null ? null : Integer.valueOf( string );
|
return string == null ? null : Integer.valueOf( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Integer value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Integer value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -82,8 +83,7 @@ public <X> X unwrap(Integer value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public <X> Integer wrap(X value, WrapperOptions options) {
|
public <X> Integer wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -92,7 +92,7 @@ public <X> Integer wrap(X value, WrapperOptions options) {
|
|||||||
return (Integer) value;
|
return (Integer) value;
|
||||||
}
|
}
|
||||||
if ( Number.class.isInstance( value ) ) {
|
if ( Number.class.isInstance( value ) ) {
|
||||||
return Integer.valueOf( ( (Number) value ).intValue() );
|
return ( (Number) value ).intValue();
|
||||||
}
|
}
|
||||||
if ( String.class.isInstance( value ) ) {
|
if ( String.class.isInstance( value ) ) {
|
||||||
return Integer.valueOf( ( (String) 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 class DateMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||||
public static final DateMutabilityPlan INSTANCE = new DateMutabilityPlan();
|
public static final DateMutabilityPlan INSTANCE = new DateMutabilityPlan();
|
||||||
|
@Override
|
||||||
public Date deepCopyNotNull(Date value) {
|
public Date deepCopyNotNull(Date value) {
|
||||||
return java.sql.Date.class.isInstance( value )
|
return java.sql.Date.class.isInstance( value )
|
||||||
? new java.sql.Date( value.getTime() )
|
? new java.sql.Date( value.getTime() )
|
||||||
@ -54,11 +54,11 @@ public Date deepCopyNotNull(Date value) {
|
|||||||
public JdbcDateTypeDescriptor() {
|
public JdbcDateTypeDescriptor() {
|
||||||
super( Date.class, DateMutabilityPlan.INSTANCE );
|
super( Date.class, DateMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Date value) {
|
public String toString(Date value) {
|
||||||
return new SimpleDateFormat( DATE_FORMAT ).format( value );
|
return new SimpleDateFormat( DATE_FORMAT ).format( value );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Date fromString(String string) {
|
public Date fromString(String string) {
|
||||||
try {
|
try {
|
||||||
return new Date( new SimpleDateFormat(DATE_FORMAT).parse( string ).getTime() );
|
return new Date( new SimpleDateFormat(DATE_FORMAT).parse( string ).getTime() );
|
||||||
@ -103,6 +103,7 @@ public int extractHashCode(Date value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -138,8 +139,7 @@ public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public <X> Date wrap(X value, WrapperOptions options) {
|
public <X> Date wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -44,7 +44,7 @@ public class JdbcTimeTypeDescriptor extends AbstractTypeDescriptor<Date> {
|
|||||||
|
|
||||||
public static class TimeMutabilityPlan extends MutableMutabilityPlan<Date> {
|
public static class TimeMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||||
public static final TimeMutabilityPlan INSTANCE = new TimeMutabilityPlan();
|
public static final TimeMutabilityPlan INSTANCE = new TimeMutabilityPlan();
|
||||||
|
@Override
|
||||||
public Date deepCopyNotNull(Date value) {
|
public Date deepCopyNotNull(Date value) {
|
||||||
return Time.class.isInstance( value )
|
return Time.class.isInstance( value )
|
||||||
? new Time( value.getTime() )
|
? new Time( value.getTime() )
|
||||||
@ -55,11 +55,11 @@ public Date deepCopyNotNull(Date value) {
|
|||||||
public JdbcTimeTypeDescriptor() {
|
public JdbcTimeTypeDescriptor() {
|
||||||
super( Date.class, TimeMutabilityPlan.INSTANCE );
|
super( Date.class, TimeMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Date value) {
|
public String toString(Date value) {
|
||||||
return new SimpleDateFormat( TIME_FORMAT ).format( value );
|
return new SimpleDateFormat( TIME_FORMAT ).format( value );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public java.util.Date fromString(String string) {
|
public java.util.Date fromString(String string) {
|
||||||
try {
|
try {
|
||||||
return new Time( new SimpleDateFormat( TIME_FORMAT ).parse( string ).getTime() );
|
return new Time( new SimpleDateFormat( TIME_FORMAT ).parse( string ).getTime() );
|
||||||
@ -106,6 +106,7 @@ public boolean areEqual(Date one, Date another) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -141,8 +142,7 @@ public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public <X> Date wrap(X value, WrapperOptions options) {
|
public <X> Date wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -152,7 +152,7 @@ public <X> Date wrap(X value, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( Long.class.isInstance( value ) ) {
|
if ( Long.class.isInstance( value ) ) {
|
||||||
return new Time( ( (Long) value ).longValue() );
|
return new Time( (Long) value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Calendar.class.isInstance( 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 class TimestampMutabilityPlan extends MutableMutabilityPlan<Date> {
|
||||||
public static final TimestampMutabilityPlan INSTANCE = new TimestampMutabilityPlan();
|
public static final TimestampMutabilityPlan INSTANCE = new TimestampMutabilityPlan();
|
||||||
|
@Override
|
||||||
public Date deepCopyNotNull(Date value) {
|
public Date deepCopyNotNull(Date value) {
|
||||||
if ( value instanceof Timestamp ) {
|
if ( value instanceof Timestamp ) {
|
||||||
Timestamp orig = (Timestamp) value;
|
Timestamp orig = (Timestamp) value;
|
||||||
@ -61,11 +61,11 @@ public Date deepCopyNotNull(Date value) {
|
|||||||
public JdbcTimestampTypeDescriptor() {
|
public JdbcTimestampTypeDescriptor() {
|
||||||
super( Date.class, TimestampMutabilityPlan.INSTANCE );
|
super( Date.class, TimestampMutabilityPlan.INSTANCE );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Date value) {
|
public String toString(Date value) {
|
||||||
return new SimpleDateFormat( TIMESTAMP_FORMAT ).format( value );
|
return new SimpleDateFormat( TIMESTAMP_FORMAT ).format( value );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Date fromString(String string) {
|
public Date fromString(String string) {
|
||||||
try {
|
try {
|
||||||
return new Timestamp( new SimpleDateFormat( TIMESTAMP_FORMAT ).parse( string ).getTime() );
|
return new Timestamp( new SimpleDateFormat( TIMESTAMP_FORMAT ).parse( string ).getTime() );
|
||||||
@ -115,6 +115,7 @@ public int extractHashCode(Date value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -150,8 +151,7 @@ public <X> X unwrap(Date value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryUnboxing" })
|
|
||||||
public <X> Date wrap(X value, WrapperOptions options) {
|
public <X> Date wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -161,7 +161,7 @@ public <X> Date wrap(X value, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( Long.class.isInstance( value ) ) {
|
if ( Long.class.isInstance( value ) ) {
|
||||||
return new Timestamp( ( (Long) value ).longValue() );
|
return new Timestamp( (Long) value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Calendar.class.isInstance( value ) ) {
|
if ( Calendar.class.isInstance( value ) ) {
|
||||||
|
@ -39,16 +39,17 @@ public class LongTypeDescriptor extends AbstractTypeDescriptor<Long> {
|
|||||||
public LongTypeDescriptor() {
|
public LongTypeDescriptor() {
|
||||||
super( Long.class );
|
super( Long.class );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Long value) {
|
public String toString(Long value) {
|
||||||
return value == null ? null : value.toString();
|
return value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Long fromString(String string) {
|
public Long fromString(String string) {
|
||||||
return Long.valueOf( string );
|
return Long.valueOf( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Long value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Long value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -82,8 +83,7 @@ public <X> X unwrap(Long value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public <X> Long wrap(X value, WrapperOptions options) {
|
public <X> Long wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -92,7 +92,7 @@ public <X> Long wrap(X value, WrapperOptions options) {
|
|||||||
return (Long) value;
|
return (Long) value;
|
||||||
}
|
}
|
||||||
if ( Number.class.isInstance( value ) ) {
|
if ( Number.class.isInstance( value ) ) {
|
||||||
return Long.valueOf( ( (Number) value ).longValue() );
|
return ( (Number) value ).longValue();
|
||||||
}
|
}
|
||||||
else if ( String.class.isInstance( value ) ) {
|
else if ( String.class.isInstance( value ) ) {
|
||||||
return Long.valueOf( ( (String) value ) );
|
return Long.valueOf( ( (String) value ) );
|
||||||
|
@ -35,16 +35,17 @@ public class ShortTypeDescriptor extends AbstractTypeDescriptor<Short> {
|
|||||||
public ShortTypeDescriptor() {
|
public ShortTypeDescriptor() {
|
||||||
super( Short.class );
|
super( Short.class );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String toString(Short value) {
|
public String toString(Short value) {
|
||||||
return value == null ? null : value.toString();
|
return value == null ? null : value.toString();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Short fromString(String string) {
|
public Short fromString(String string) {
|
||||||
return Short.valueOf( string );
|
return Short.valueOf( string );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
@Override
|
||||||
public <X> X unwrap(Short value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(Short value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -72,8 +73,7 @@ public <X> X unwrap(Short value, Class<X> type, WrapperOptions options) {
|
|||||||
}
|
}
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
|
||||||
public <X> Short wrap(X value, WrapperOptions options) {
|
public <X> Short wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
@ -82,7 +82,7 @@ public <X> Short wrap(X value, WrapperOptions options) {
|
|||||||
return (Short) value;
|
return (Short) value;
|
||||||
}
|
}
|
||||||
if ( Number.class.isInstance( value ) ) {
|
if ( Number.class.isInstance( value ) ) {
|
||||||
return Short.valueOf( ( (Number) value ).shortValue() );
|
return ( (Number) value ).shortValue();
|
||||||
}
|
}
|
||||||
if ( String.class.isInstance( value ) ) {
|
if ( String.class.isInstance( value ) ) {
|
||||||
return Short.valueOf( ( (String) value ) );
|
return Short.valueOf( ( (String) value ) );
|
||||||
|
@ -45,12 +45,11 @@ public static enum Family {
|
|||||||
|
|
||||||
private final int[] typeCodes;
|
private final int[] typeCodes;
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryBoxing")
|
|
||||||
private Family(int... typeCodes) {
|
private Family(int... typeCodes) {
|
||||||
this.typeCodes = typeCodes;
|
this.typeCodes = typeCodes;
|
||||||
|
|
||||||
for ( int typeCode : typeCodes ) {
|
for ( final int typeCode : typeCodes ) {
|
||||||
JdbcTypeFamilyInformation.INSTANCE.typeCodeToFamilyMap.put( Integer.valueOf( typeCode ), this );
|
JdbcTypeFamilyInformation.INSTANCE.typeCodeToFamilyMap.put( typeCode, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ public int[] getTypeCodes() {
|
|||||||
*
|
*
|
||||||
* @return The family of datatypes the type code belongs to, or {@code null} if it belongs to no known families.
|
* @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) {
|
public Family locateJdbcTypeFamilyByTypeCode(int typeCode) {
|
||||||
return typeCodeToFamilyMap.get( Integer.valueOf( typeCode ) );
|
return typeCodeToFamilyMap.get( Integer.valueOf( typeCode ) );
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,6 @@ private void addToBoth(int typeCode, Class javaType ) {
|
|||||||
javaClassToJdbcTypeCodeMap.put( javaType, typeCode );
|
javaClassToJdbcTypeCodeMap.put( javaType, typeCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public int determineJdbcTypeCodeForJavaClass(Class cls) {
|
public int determineJdbcTypeCodeForJavaClass(Class cls) {
|
||||||
Integer typeCode = javaClassToJdbcTypeCodeMap.get( cls );
|
Integer typeCode = javaClassToJdbcTypeCodeMap.get( cls );
|
||||||
if ( typeCode != null ) {
|
if ( typeCode != null ) {
|
||||||
@ -118,7 +117,6 @@ public int determineJdbcTypeCodeForJavaClass(Class cls) {
|
|||||||
return specialCode;
|
return specialCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryUnboxing")
|
|
||||||
public Class determineJavaClassForJdbcTypeCode(int typeCode) {
|
public Class determineJavaClassForJdbcTypeCode(int typeCode) {
|
||||||
Class cls = jdbcTypeCodeToJavaClassMap.get( Integer.valueOf( typeCode ) );
|
Class cls = jdbcTypeCodeToJavaClassMap.get( Integer.valueOf( typeCode ) );
|
||||||
if ( cls != null ) {
|
if ( cls != null ) {
|
||||||
|
@ -50,12 +50,10 @@ public class SqlTypeDescriptorRegistry {
|
|||||||
|
|
||||||
private ConcurrentHashMap<Integer,SqlTypeDescriptor> descriptorMap = new ConcurrentHashMap<Integer, SqlTypeDescriptor>();
|
private ConcurrentHashMap<Integer,SqlTypeDescriptor> descriptorMap = new ConcurrentHashMap<Integer, SqlTypeDescriptor>();
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryBoxing")
|
|
||||||
public void addDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
public void addDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||||
descriptorMap.put( Integer.valueOf( sqlTypeDescriptor.getSqlType() ), sqlTypeDescriptor );
|
descriptorMap.put( sqlTypeDescriptor.getSqlType(), sqlTypeDescriptor );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("UnnecessaryBoxing")
|
|
||||||
public SqlTypeDescriptor getDescriptor(int jdbcTypeCode) {
|
public SqlTypeDescriptor getDescriptor(int jdbcTypeCode) {
|
||||||
SqlTypeDescriptor descriptor = descriptorMap.get( Integer.valueOf( jdbcTypeCode ) );
|
SqlTypeDescriptor descriptor = descriptorMap.get( Integer.valueOf( jdbcTypeCode ) );
|
||||||
if ( descriptor != null ) {
|
if ( descriptor != null ) {
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public class Mocks {
|
public class Mocks {
|
||||||
|
|
||||||
public static Connection createConnection(String databaseName, int majorVersion) {
|
public static Connection createConnection(String databaseName, int majorVersion) {
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||||
import org.hibernate.dialect.PostgreSQL9Dialect;
|
import org.hibernate.dialect.PostgreSQL9Dialect;
|
||||||
|
import org.hibernate.dialect.PostgresPlusDialect;
|
||||||
import org.hibernate.dialect.SQLServerDialect;
|
import org.hibernate.dialect.SQLServerDialect;
|
||||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||||
import org.hibernate.dialect.SybaseAnywhereDialect;
|
import org.hibernate.dialect.SybaseAnywhereDialect;
|
||||||
@ -148,6 +149,7 @@ public void testPreregisteredDialects() {
|
|||||||
testDetermination( "PostgreSQL", PostgreSQL81Dialect.class, resolver );
|
testDetermination( "PostgreSQL", PostgreSQL81Dialect.class, resolver );
|
||||||
testDetermination( "PostgreSQL", 8, 2, PostgreSQL82Dialect.class, resolver );
|
testDetermination( "PostgreSQL", 8, 2, PostgreSQL82Dialect.class, resolver );
|
||||||
testDetermination( "PostgreSQL", 9, 0, PostgreSQL9Dialect.class, resolver );
|
testDetermination( "PostgreSQL", 9, 0, PostgreSQL9Dialect.class, resolver );
|
||||||
|
testDetermination( "EnterpriseDB", 9, 2, PostgresPlusDialect.class, resolver );
|
||||||
testDetermination( "Apache Derby", 10, 4, DerbyDialect.class, resolver );
|
testDetermination( "Apache Derby", 10, 4, DerbyDialect.class, resolver );
|
||||||
testDetermination( "Apache Derby", 10, 5, DerbyTenFiveDialect.class, resolver );
|
testDetermination( "Apache Derby", 10, 5, DerbyTenFiveDialect.class, resolver );
|
||||||
testDetermination( "Apache Derby", 10, 6, DerbyTenSixDialect.class, resolver );
|
testDetermination( "Apache Derby", 10, 6, DerbyTenSixDialect.class, resolver );
|
||||||
|
@ -189,4 +189,10 @@ protected String[] getAnnotatedPackages() {
|
|||||||
"org.hibernate.test.annotations.any"
|
"org.hibernate.test.annotations.any"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simply having this orm.xml file in the classpath reproduces HHH-4261.
|
||||||
|
@Override
|
||||||
|
protected String[] getXmlFiles() {
|
||||||
|
return new String[] { "org/hibernate/test/annotations/any/orm.xml" };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 by Red Hat Inc and/or its affiliates or by
|
||||||
|
* third-party contributors as indicated by either @author tags or express
|
||||||
|
* copyright attribution statements applied by the authors. All
|
||||||
|
* third-party contributions are distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.test.annotations.lob.locator;
|
||||||
|
|
||||||
|
import java.sql.Blob;
|
||||||
|
import java.sql.Clob;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
public class LobHolder {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Clob clobLocator;
|
||||||
|
|
||||||
|
private Blob blobLocator;
|
||||||
|
|
||||||
|
private Integer counter;
|
||||||
|
|
||||||
|
public LobHolder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public LobHolder(Blob blobLocator, Clob clobLocator, Integer counter) {
|
||||||
|
this.blobLocator = blobLocator;
|
||||||
|
this.clobLocator = clobLocator;
|
||||||
|
this.counter = counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Clob getClobLocator() {
|
||||||
|
return clobLocator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClobLocator(Clob clobLocator) {
|
||||||
|
this.clobLocator = clobLocator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Blob getBlobLocator() {
|
||||||
|
return blobLocator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlobLocator(Blob blobLocator) {
|
||||||
|
this.blobLocator = blobLocator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCounter() {
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCounter(Integer counter) {
|
||||||
|
this.counter = counter;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 by Red Hat Inc and/or its affiliates or by
|
||||||
|
* third-party contributors as indicated by either @author tags or express
|
||||||
|
* copyright attribution statements applied by the authors. All
|
||||||
|
* third-party contributions are distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.test.annotations.lob.locator;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
import org.hibernate.type.descriptor.java.DataHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
||||||
|
*/
|
||||||
|
public class LobLocatorTest extends BaseCoreFunctionalTestCase {
|
||||||
|
@Override
|
||||||
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
|
return new Class<?>[] { LobHolder.class };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specific JDBC drivers (e.g. SQL Server) may not automatically rewind bound input stream
|
||||||
|
* during statement execution. Such behavior results in error message similar to:
|
||||||
|
* {@literal The stream value is not the specified length. The specified length was 4, the actual length is 0.}
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@TestForIssue(jiraKey = "HHH-8193")
|
||||||
|
@RequiresDialectFeature(DialectChecks.UsesInputStreamToInsertBlob.class)
|
||||||
|
public void testStreamResetBeforeParameterBinding() throws SQLException {
|
||||||
|
final Session session = openSession();
|
||||||
|
|
||||||
|
session.getTransaction().begin();
|
||||||
|
LobHolder entity = new LobHolder(
|
||||||
|
session.getLobHelper().createBlob( "blob".getBytes() ),
|
||||||
|
session.getLobHelper().createClob( "clob" ), 0
|
||||||
|
);
|
||||||
|
session.persist( entity );
|
||||||
|
session.getTransaction().commit();
|
||||||
|
|
||||||
|
final Integer updatesLimit = 3;
|
||||||
|
|
||||||
|
for ( int i = 1; i <= updatesLimit; ++i ) {
|
||||||
|
session.getTransaction().begin();
|
||||||
|
entity = (LobHolder) session.get( LobHolder.class, entity.getId() );
|
||||||
|
entity.setCounter( i );
|
||||||
|
entity = (LobHolder) session.merge( entity );
|
||||||
|
session.getTransaction().commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
session.getTransaction().begin();
|
||||||
|
entity = (LobHolder) session.get( LobHolder.class, entity.getId() );
|
||||||
|
entity.setBlobLocator( session.getLobHelper().createBlob( "updated blob".getBytes() ) );
|
||||||
|
entity.setClobLocator( session.getLobHelper().createClob( "updated clob" ) );
|
||||||
|
entity = (LobHolder) session.merge( entity );
|
||||||
|
session.getTransaction().commit();
|
||||||
|
|
||||||
|
session.clear();
|
||||||
|
|
||||||
|
session.getTransaction().begin();
|
||||||
|
checkState( "updated blob".getBytes(), "updated clob", updatesLimit, (LobHolder) session.get( LobHolder.class, entity.getId() ) );
|
||||||
|
session.getTransaction().commit();
|
||||||
|
|
||||||
|
session.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkState(byte[] blob, String clob, Integer counter, LobHolder entity) throws SQLException {
|
||||||
|
Assert.assertEquals( counter, entity.getCounter() );
|
||||||
|
Assert.assertArrayEquals( blob, DataHelper.extractBytes( entity.getBlobLocator().getBinaryStream() ) );
|
||||||
|
Assert.assertEquals( clob, DataHelper.extractString( entity.getClobLocator() ) );
|
||||||
|
}
|
||||||
|
}
|
@ -12,8 +12,8 @@
|
|||||||
/**
|
/**
|
||||||
* @author Shawn Clowater
|
* @author Shawn Clowater
|
||||||
*/
|
*/
|
||||||
public class EntityPersister extends SingleTableEntityPersister {
|
|
||||||
@SuppressWarnings({ "UnusedDeclaration" })
|
@SuppressWarnings({ "UnusedDeclaration" })
|
||||||
|
public class EntityPersister extends SingleTableEntityPersister {
|
||||||
public EntityPersister(PersistentClass persistentClass, EntityRegionAccessStrategy cache,
|
public EntityPersister(PersistentClass persistentClass, EntityRegionAccessStrategy cache,
|
||||||
NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
|
NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
|
||||||
SessionFactoryImplementor factory, Mapping cfg) throws HibernateException {
|
SessionFactoryImplementor factory, Mapping cfg) throws HibernateException {
|
||||||
|
@ -49,7 +49,6 @@ public String[] getMappings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testSaveChildWithParent() {
|
public void testSaveChildWithParent() {
|
||||||
Session session = openSession();
|
Session session = openSession();
|
||||||
Transaction txn = session.beginTransaction();
|
Transaction txn = session.beginTransaction();
|
||||||
|
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.test.classloader;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.Transaction;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
|
import org.hibernate.proxy.HibernateProxy;
|
||||||
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests if javassist instrumentation is done with the proper classloader for entities with proxy class. The classloader
|
||||||
|
* of {@link HibernateProxy} will not see {@link IPerson}, since it is only accessible from this package. But: the
|
||||||
|
* classloader of {@link IPerson} will see {@link HibernateProxy}, so instrumentation will only work if this classloader
|
||||||
|
* is chosen for creating the instrumented proxy class. We need to check the class of a loaded object though, since
|
||||||
|
* building the configuration will not fail, only log the error and fall back to using the entity class itself as a
|
||||||
|
* proxy.
|
||||||
|
*
|
||||||
|
* @author lgathy
|
||||||
|
*/
|
||||||
|
public class ProxyInterfaceClassLoaderTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
|
return new Class[] { Person.class };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProxyClassLoader() {
|
||||||
|
|
||||||
|
Session s = openSession();
|
||||||
|
Transaction t = s.beginTransaction();
|
||||||
|
IPerson p = new Person();
|
||||||
|
p.setId( 1 );
|
||||||
|
s.persist( p );
|
||||||
|
s.flush();
|
||||||
|
s.clear();
|
||||||
|
|
||||||
|
Object lp = s.load( Person.class, p.getId() );
|
||||||
|
|
||||||
|
Assert.assertTrue( "Loaded entity is not an instance of the proxy interface", IPerson.class.isInstance( lp ) );
|
||||||
|
Assert.assertFalse( "Proxy class was not created", Person.class.isInstance( lp ) );
|
||||||
|
|
||||||
|
s.delete( lp );
|
||||||
|
t.commit();
|
||||||
|
s.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IPerson {
|
||||||
|
|
||||||
|
int getId();
|
||||||
|
|
||||||
|
void setId(int id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Proxy(proxyClass = IPerson.class)
|
||||||
|
static class Person implements IPerson {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -78,7 +78,6 @@ public String[] getMappings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testDialectSQLFunctions() throws Exception {
|
public void testDialectSQLFunctions() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -138,7 +137,6 @@ public void testDialectSQLFunctions() throws Exception {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
|
||||||
public void testSetProperties() throws Exception {
|
public void testSetProperties() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -173,7 +171,6 @@ String[] getStuff() {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testBroken() throws Exception {
|
public void testBroken() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -205,7 +202,6 @@ public void testBroken() throws Exception {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testNothinToUpdate() throws Exception {
|
public void testNothinToUpdate() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -229,7 +225,6 @@ public void testNothinToUpdate() throws Exception {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testCachedQuery() throws Exception {
|
public void testCachedQuery() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -290,7 +285,6 @@ public void testCachedQuery() throws Exception {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testCachedQueryRegion() throws Exception {
|
public void testCachedQueryRegion() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -344,7 +338,6 @@ public void testCachedQueryRegion() throws Exception {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing", "unchecked"})
|
|
||||||
public void testSQLFunctions() throws Exception {
|
public void testSQLFunctions() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -542,7 +535,6 @@ public void testBlobClob() throws Exception {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testSqlFunctionAsAlias() throws Exception {
|
public void testSqlFunctionAsAlias() throws Exception {
|
||||||
String functionName = locateAppropriateDialectFunctionNameForAliasTest();
|
String functionName = locateAppropriateDialectFunctionNameForAliasTest();
|
||||||
if (functionName == null) {
|
if (functionName == null) {
|
||||||
@ -583,7 +575,6 @@ private String locateAppropriateDialectFunctionNameForAliasTest() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testCachedQueryOnInsert() throws Exception {
|
public void testCachedQueryOnInsert() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -638,7 +629,6 @@ public void testCachedQueryOnInsert() throws Exception {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing", "UnnecessaryUnboxing"})
|
|
||||||
public void testInterSystemsFunctions() throws Exception {
|
public void testInterSystemsFunctions() throws Exception {
|
||||||
Calendar cal = new GregorianCalendar();
|
Calendar cal = new GregorianCalendar();
|
||||||
cal.set(1977,6,3,0,0,0);
|
cal.set(1977,6,3,0,0,0);
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||||
|
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||||
|
<hibernate-mapping package="org.hibernate.test.extralazy">
|
||||||
|
<class name="Child" >
|
||||||
|
<id name="id" >
|
||||||
|
<column name="ID" length="32" />
|
||||||
|
<generator class="uuid.hex" />
|
||||||
|
</id>
|
||||||
|
|
||||||
|
<property name="firstName" />
|
||||||
|
|
||||||
|
<many-to-one name="parent"
|
||||||
|
column="PARENT_ID"
|
||||||
|
class="Parent" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</class>
|
||||||
|
</hibernate-mapping>
|
@ -0,0 +1,36 @@
|
|||||||
|
package org.hibernate.test.extralazy;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class Child {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private Parent parent;
|
||||||
|
|
||||||
|
private String firstName;
|
||||||
|
|
||||||
|
public void setParent(Parent parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Parent getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstName(String firstName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstName() {
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
@ -22,29 +22,29 @@
|
|||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.extralazy;
|
package org.hibernate.test.extralazy;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.Transaction;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.Transaction;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class ExtraLazyTest extends BaseCoreFunctionalTestCase {
|
public class ExtraLazyTest extends BaseCoreFunctionalTestCase {
|
||||||
@Override
|
@Override
|
||||||
public String[] getMappings() {
|
public String[] getMappings() {
|
||||||
return new String[] { "extralazy/UserGroup.hbm.xml" };
|
return new String[] { "extralazy/UserGroup.hbm.xml","extralazy/Parent.hbm.xml","extralazy/Child.hbm.xml" };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -240,5 +240,26 @@ public void testSQLQuery() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestForIssue(jiraKey="HHH-4294")
|
||||||
|
public void testMap() {
|
||||||
|
Session session1 = openSession();
|
||||||
|
Transaction tx1 = session1.beginTransaction();
|
||||||
|
Parent parent = new Parent ();
|
||||||
|
Child child = new Child ();
|
||||||
|
child.setFirstName("Ben");
|
||||||
|
parent.getChildren().put(child.getFirstName(), child);
|
||||||
|
child.setParent(parent);
|
||||||
|
session1.save(parent);
|
||||||
|
tx1.commit();
|
||||||
|
session1.close();
|
||||||
|
// END PREPARE SECTION
|
||||||
|
|
||||||
|
Session session2 = openSession();
|
||||||
|
Parent parent2 = (Parent)session2.get(Parent.class, parent.getId());
|
||||||
|
Child child2 = parent2.getChildren().get(child.getFirstName()); // causes SQLGrammarException because of wrong condition: where child0_.PARENT_ID=? and child0_.null=?
|
||||||
|
assertNotNull(child2);
|
||||||
|
session2.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE hibernate-mapping PUBLIC
|
||||||
|
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||||
|
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||||
|
<hibernate-mapping package="org.hibernate.test.extralazy">
|
||||||
|
<class name="Parent" >
|
||||||
|
|
||||||
|
<!-- properties inherited from Adapter -->
|
||||||
|
<id name="id" >
|
||||||
|
<column name="TSGID" length="32" />
|
||||||
|
<generator class="uuid.hex" />
|
||||||
|
</id>
|
||||||
|
|
||||||
|
<map name="children" lazy="extra" inverse="true" cascade="save-update">
|
||||||
|
<key column="PARENT_ID" />
|
||||||
|
<map-key type="string" formula="firstName"/>
|
||||||
|
<one-to-many class="Child" />
|
||||||
|
</map>
|
||||||
|
|
||||||
|
</class>
|
||||||
|
</hibernate-mapping>
|
@ -0,0 +1,29 @@
|
|||||||
|
package org.hibernate.test.extralazy;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class Parent {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private Map <String, Child> children = new HashMap<String, Child> ();
|
||||||
|
|
||||||
|
public void setChildren(Map <String, Child> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map <String, Child> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
@ -52,7 +52,6 @@ public String[] getMappings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testFilteredJoinedSubclassHqlDeleteRoot() {
|
public void testFilteredJoinedSubclassHqlDeleteRoot() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
@ -79,7 +78,6 @@ public void testFilteredJoinedSubclassHqlDeleteRoot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testFilteredJoinedSubclassHqlDeleteNonLeaf() {
|
public void testFilteredJoinedSubclassHqlDeleteNonLeaf() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
@ -106,7 +104,6 @@ public void testFilteredJoinedSubclassHqlDeleteNonLeaf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testFilteredJoinedSubclassHqlDeleteLeaf() {
|
public void testFilteredJoinedSubclassHqlDeleteLeaf() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
@ -133,7 +130,6 @@ public void testFilteredJoinedSubclassHqlDeleteLeaf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testFilteredJoinedSubclassHqlUpdateRoot() {
|
public void testFilteredJoinedSubclassHqlUpdateRoot() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
@ -160,7 +156,6 @@ public void testFilteredJoinedSubclassHqlUpdateRoot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testFilteredJoinedSubclassHqlUpdateNonLeaf() {
|
public void testFilteredJoinedSubclassHqlUpdateNonLeaf() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
@ -190,7 +185,6 @@ public void testFilteredJoinedSubclassHqlUpdateNonLeaf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testFilteredJoinedSubclassHqlUpdateLeaf() {
|
public void testFilteredJoinedSubclassHqlUpdateLeaf() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
|
@ -1171,7 +1171,6 @@ public void testJdkEnumStyleEnumConstant() throws Exception {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
@FailureExpected( jiraKey = "unknown" )
|
@FailureExpected( jiraKey = "unknown" )
|
||||||
public void testParameterTypeMismatch() {
|
public void testParameterTypeMismatch() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
@ -1488,7 +1487,6 @@ public void testInvalidFetchSemantics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
public void testArithmetic() {
|
public void testArithmetic() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -1806,7 +1804,6 @@ public void testCastInSelect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testNumericExpressionReturnTypes() {
|
public void testNumericExpressionReturnTypes() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -1969,7 +1966,6 @@ public void testOrdinalParameters() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
|
||||||
public void testIndexParams() {
|
public void testIndexParams() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -2002,7 +1998,6 @@ public void testIndexParams() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipForDialect( value = SybaseASE15Dialect.class, jiraKey = "HHH-6424")
|
@SkipForDialect( value = SybaseASE15Dialect.class, jiraKey = "HHH-6424")
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
public void testAggregation() {
|
public void testAggregation() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
|
@ -419,7 +419,6 @@ public void testInsertWithGeneratedId() {
|
|||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
@Test
|
@Test
|
||||||
public void testInsertWithGeneratedVersionAndId() {
|
public void testInsertWithGeneratedVersionAndId() {
|
||||||
// Make sure the env supports bulk inserts with generated ids...
|
// Make sure the env supports bulk inserts with generated ids...
|
||||||
@ -469,7 +468,6 @@ public void testInsertWithGeneratedVersionAndId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
@RequiresDialectFeature(
|
@RequiresDialectFeature(
|
||||||
value = DialectChecks.SupportsParametersInInsertSelectCheck.class,
|
value = DialectChecks.SupportsParametersInInsertSelectCheck.class,
|
||||||
comment = "dialect does not support parameter in INSERT ... SELECT"
|
comment = "dialect does not support parameter in INSERT ... SELECT"
|
||||||
@ -704,7 +702,6 @@ public void testIncrementTimestampVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
public void testUpdateOnComponent() {
|
public void testUpdateOnComponent() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
@ -795,7 +792,6 @@ public void testUpdateOnImplicitJoinFails() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
public void testUpdateOnDiscriminatorSubclass() {
|
public void testUpdateOnDiscriminatorSubclass() {
|
||||||
TestData data = new TestData();
|
TestData data = new TestData();
|
||||||
data.prepare();
|
data.prepare();
|
||||||
@ -1020,7 +1016,6 @@ public void testDeleteWithSubquery() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings( {"UnnecessaryUnboxing"})
|
|
||||||
@RequiresDialectFeature(
|
@RequiresDialectFeature(
|
||||||
value = DialectChecks.HasSelfReferentialForeignKeyBugCheck.class,
|
value = DialectChecks.HasSelfReferentialForeignKeyBugCheck.class,
|
||||||
comment = "self referential FK bug"
|
comment = "self referential FK bug"
|
||||||
|
@ -24,15 +24,15 @@
|
|||||||
package org.hibernate.test.hql;
|
package org.hibernate.test.hql;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.dialect.MySQLDialect;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|
||||||
import org.hibernate.test.annotations.query.Attrset;
|
import org.hibernate.test.annotations.query.Attrset;
|
||||||
import org.hibernate.test.annotations.query.Attrvalue;
|
import org.hibernate.test.annotations.query.Attrvalue;
|
||||||
import org.hibernate.test.annotations.query.Employee;
|
import org.hibernate.test.annotations.query.Employee;
|
||||||
import org.hibernate.test.annotations.query.Employeegroup;
|
import org.hibernate.test.annotations.query.Employeegroup;
|
||||||
|
import org.hibernate.testing.SkipForDialect;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
@ -51,7 +51,7 @@ protected Class[] getAnnotatedClasses() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-8318" )
|
@TestForIssue( jiraKey = "HHH-8318" )
|
||||||
// @FailureExpected( jiraKey = "HHH-8318" )
|
@SkipForDialect( value = MySQLDialect.class, comment = "Cannot use Attrvalue in the delete and from clauses simultaneously." )
|
||||||
public void testDeleteMemberOf() {
|
public void testDeleteMemberOf() {
|
||||||
final String qry = "delete Attrvalue aval where aval.id in ( "
|
final String qry = "delete Attrvalue aval where aval.id in ( "
|
||||||
+ "select val2.id from Employee e, Employeegroup eg, Attrset aset, Attrvalue val2 "
|
+ "select val2.id from Employee e, Employeegroup eg, Attrset aset, Attrvalue val2 "
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.test.hql;
|
package org.hibernate.test.hql;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -227,8 +228,8 @@ private void checkReturnedTypes(QueryTranslator oldQueryTranslator, QueryTransla
|
|||||||
|
|
||||||
private void checkQuerySpaces(QueryTranslator oldQueryTranslator, QueryTranslator newQueryTranslator) {
|
private void checkQuerySpaces(QueryTranslator oldQueryTranslator, QueryTranslator newQueryTranslator) {
|
||||||
// Check the query spaces for a regression.
|
// Check the query spaces for a regression.
|
||||||
Set oldQuerySpaces = oldQueryTranslator.getQuerySpaces();
|
Set<Serializable> oldQuerySpaces = oldQueryTranslator.getQuerySpaces();
|
||||||
Set querySpaces = newQueryTranslator.getQuerySpaces();
|
Set<Serializable> querySpaces = newQueryTranslator.getQuerySpaces();
|
||||||
assertEquals( "Query spaces is not the right size!", oldQuerySpaces.size(), querySpaces.size() );
|
assertEquals( "Query spaces is not the right size!", oldQuerySpaces.size(), querySpaces.size() );
|
||||||
for ( Object o : oldQuerySpaces ) {
|
for ( Object o : oldQuerySpaces ) {
|
||||||
assertTrue( "New query space does not contain " + o + "!", querySpaces.contains( o ) );
|
assertTrue( "New query space does not contain " + o + "!", querySpaces.contains( o ) );
|
||||||
@ -280,7 +281,6 @@ private void assertSQLEquals(String message, String oldsql, String newsql) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings( {"UnnecessaryBoxing", "UnnecessaryUnboxing"})
|
|
||||||
private Map getTokens(String sql) {
|
private Map getTokens(String sql) {
|
||||||
Map<String,Integer> result = new TreeMap<String,Integer>();
|
Map<String,Integer> result = new TreeMap<String,Integer>();
|
||||||
if ( sql == null ) {
|
if ( sql == null ) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user