HHH-7919 : Miscellaneous bugfixes

This commit is contained in:
Strong Liu 2013-07-18 04:19:14 +08:00
parent da40234ab7
commit b1312381b1
4 changed files with 12 additions and 35 deletions

View File

@ -45,16 +45,12 @@ public class TypeLocatorImpl implements TypeHelper, Serializable {
this.typeResolver = typeResolver; this.typeResolver = typeResolver;
} }
/** @Override
* {@inheritDoc}
*/
public BasicType basic(String name) { public BasicType basic(String name) {
return typeResolver.basic( name ); return typeResolver.basic( name );
} }
/** @Override
* {@inheritDoc}
*/
public BasicType basic(Class javaType) { public BasicType basic(Class javaType) {
BasicType type = typeResolver.basic( javaType.getName() ); BasicType type = typeResolver.basic( javaType.getName() );
if ( type == null ) { if ( type == null ) {
@ -134,39 +130,27 @@ public class TypeLocatorImpl implements TypeHelper, Serializable {
return null; return null;
} }
/** @Override
* {@inheritDoc}
*/
public Type heuristicType(String name) { public Type heuristicType(String name) {
return typeResolver.heuristicType( name ); return typeResolver.heuristicType( name );
} }
/** @Override
* {@inheritDoc}
*/
public Type entity(Class entityClass) { public Type entity(Class entityClass) {
return entity( entityClass.getName() ); return entity( entityClass.getName() );
} }
/** @Override
* {@inheritDoc}
*/
public Type entity(String entityName) { public Type entity(String entityName) {
return typeResolver.getTypeFactory().manyToOne( entityName ); return typeResolver.getTypeFactory().manyToOne( entityName );
} }
/** @Override
* {@inheritDoc}
*/
@SuppressWarnings({ "unchecked" })
public Type custom(Class userTypeClass) { public Type custom(Class userTypeClass) {
return custom( userTypeClass, null ); return custom( userTypeClass, null );
} }
/** @Override
* {@inheritDoc}
*/
@SuppressWarnings({ "unchecked" })
public Type custom(Class userTypeClass, Properties parameters) { public Type custom(Class userTypeClass, Properties parameters) {
if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) { if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
return typeResolver.getTypeFactory().customComponent( userTypeClass, parameters ); return typeResolver.getTypeFactory().customComponent( userTypeClass, parameters );
@ -176,9 +160,7 @@ public class TypeLocatorImpl implements TypeHelper, Serializable {
} }
} }
/** @Override
* {@inheritDoc}
*/
public Type any(Type metaType, Type identifierType) { public Type any(Type metaType, Type identifierType) {
return typeResolver.getTypeFactory().any( metaType, identifierType ); return typeResolver.getTypeFactory().any( metaType, identifierType );
} }

View File

@ -44,7 +44,7 @@ public class BasicTypeRegistry implements Serializable {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BasicTypeRegistry.class.getName()); private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BasicTypeRegistry.class.getName());
// TODO : analyze these sizing params; unfortunately this seems to be the only way to give a "concurrencyLevel" // TODO : analyze these sizing params; unfortunately this seems to be the only way to give a "concurrencyLevel"
private Map<String,BasicType> registry = new ConcurrentHashMap<String, BasicType>( 100, .75f, 1 ); private final Map<String,BasicType> registry = new ConcurrentHashMap<String, BasicType>( 100, .75f, 1 );
private boolean locked = false; private boolean locked = false;
public BasicTypeRegistry() { public BasicTypeRegistry() {

View File

@ -40,11 +40,8 @@ import org.hibernate.usertype.UserType;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
/** /**
* Used internally to build instances of {@link Type}, specifically it builds instances of * Used internally to obtain instances of {@link Type}. Applications should use static methods
* * and constants on {@link StandardBasicTypes}.
*
* Used internally to obtain instances of <tt>Type</tt>. Applications should use static methods
* and constants on <tt>org.hibernate.Hibernate</tt>.
* *
* @author Gavin King * @author Gavin King
* @author Steve Ebersole * @author Steve Ebersole

View File

@ -142,9 +142,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseFunctionalTestCase
} }
protected void rebuildSessionFactory() { protected void rebuildSessionFactory() {
if ( sessionFactory == null ) { releaseSessionFactory();
return;
}
buildSessionFactory(); buildSessionFactory();
} }