From b1312381b17b326a978c69332749caa907678605 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Thu, 18 Jul 2013 04:19:14 +0800 Subject: [PATCH] HHH-7919 : Miscellaneous bugfixes --- .../hibernate/internal/TypeLocatorImpl.java | 34 +++++-------------- .../org/hibernate/type/BasicTypeRegistry.java | 2 +- .../java/org/hibernate/type/TypeFactory.java | 7 ++-- .../junit4/BaseCoreFunctionalTestCase.java | 4 +-- 4 files changed, 12 insertions(+), 35 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/TypeLocatorImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/TypeLocatorImpl.java index 1cd5c0a477..0fd9218046 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/TypeLocatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/TypeLocatorImpl.java @@ -45,16 +45,12 @@ public class TypeLocatorImpl implements TypeHelper, Serializable { this.typeResolver = typeResolver; } - /** - * {@inheritDoc} - */ + @Override public BasicType basic(String name) { return typeResolver.basic( name ); } - /** - * {@inheritDoc} - */ + @Override public BasicType basic(Class javaType) { BasicType type = typeResolver.basic( javaType.getName() ); if ( type == null ) { @@ -134,39 +130,27 @@ public class TypeLocatorImpl implements TypeHelper, Serializable { return null; } - /** - * {@inheritDoc} - */ + @Override public Type heuristicType(String name) { return typeResolver.heuristicType( name ); } - /** - * {@inheritDoc} - */ + @Override public Type entity(Class entityClass) { return entity( entityClass.getName() ); } - /** - * {@inheritDoc} - */ + @Override public Type entity(String entityName) { return typeResolver.getTypeFactory().manyToOne( entityName ); } - /** - * {@inheritDoc} - */ - @SuppressWarnings({ "unchecked" }) + @Override public Type custom(Class userTypeClass) { return custom( userTypeClass, null ); } - /** - * {@inheritDoc} - */ - @SuppressWarnings({ "unchecked" }) + @Override public Type custom(Class userTypeClass, Properties parameters) { if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) { return typeResolver.getTypeFactory().customComponent( userTypeClass, parameters ); @@ -176,9 +160,7 @@ public class TypeLocatorImpl implements TypeHelper, Serializable { } } - /** - * {@inheritDoc} - */ + @Override public Type any(Type metaType, Type identifierType) { return typeResolver.getTypeFactory().any( metaType, identifierType ); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/BasicTypeRegistry.java b/hibernate-core/src/main/java/org/hibernate/type/BasicTypeRegistry.java index 05e91c1d3f..9611efd46b 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/BasicTypeRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/type/BasicTypeRegistry.java @@ -44,7 +44,7 @@ public class BasicTypeRegistry implements Serializable { 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" - private Map registry = new ConcurrentHashMap( 100, .75f, 1 ); + private final Map registry = new ConcurrentHashMap( 100, .75f, 1 ); private boolean locked = false; public BasicTypeRegistry() { diff --git a/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java b/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java index d2ffa452b0..dc455f56c3 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java @@ -40,11 +40,8 @@ import org.hibernate.usertype.UserType; import org.jboss.logging.Logger; /** - * Used internally to build instances of {@link Type}, specifically it builds instances of - * - * - * Used internally to obtain instances of Type. Applications should use static methods - * and constants on org.hibernate.Hibernate. + * Used internally to obtain instances of {@link Type}. Applications should use static methods + * and constants on {@link StandardBasicTypes}. * * @author Gavin King * @author Steve Ebersole diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java index fd1496a1e3..0f9452be0b 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java @@ -142,9 +142,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseFunctionalTestCase } protected void rebuildSessionFactory() { - if ( sessionFactory == null ) { - return; - } + releaseSessionFactory(); buildSessionFactory(); }