HHH-7703: @TypeDefs processed, but not used

https://hibernate.onjira.com/browse/HHH-7703
This commit is contained in:
brmeyer 2012-10-19 13:40:37 -04:00
parent 567df233cc
commit 22b0203ea7
3 changed files with 6 additions and 12 deletions

View File

@ -365,14 +365,8 @@ public class Binder {
attributeSource.getNaturalIdMutability(),
createMetaAttributeContext( attributeBindingContainer, attributeSource ),
attributeSource.getGeneration() );
final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();
typeHelper.bindSingularAttributeTypeInformation( attributeSource,
attributeBinding );
// TODO: Move heuristic type into typeHelper?
Type resolvedType = heuristicType( hibernateTypeDescriptor );
bindHibernateResolvedType( attributeBinding.getHibernateTypeDescriptor(), resolvedType );
typeHelper.bindJdbcDataType( resolvedType, relationalValueBindings );
attributeBinding.getAttribute().resolveType( bindingContext().makeJavaType( hibernateTypeDescriptor.getJavaTypeName() ) );
return attributeBinding;
}

View File

@ -33,6 +33,7 @@ import org.hibernate.AssertionFailure;
import org.hibernate.DuplicateMappingException;
import org.hibernate.MappingException;
import org.hibernate.SessionFactory;
import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.NamingStrategy;
@ -230,12 +231,12 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
if ( typeDefinition == null ) {
throw new IllegalArgumentException( "Type definition is null" );
}
else if ( typeDefinition.getName() == null ) {
throw new IllegalArgumentException( "Type definition name is null: " + typeDefinition.getTypeImplementorClass().getName() );
}
// Need to register both by name and registration keys.
addTypeDefinition( typeDefinition.getName(), typeDefinition );
if ( !StringHelper.isEmpty( typeDefinition.getName() ) ) {
addTypeDefinition( typeDefinition.getName(), typeDefinition );
}
for ( String registrationKey : typeDefinition.getRegistrationKeys() ) {
addTypeDefinition( registrationKey, typeDefinition );
}

View File

@ -15,8 +15,7 @@ import org.hibernate.annotations.TypeDefs;
*/
@Entity
@TypeDefs({
@TypeDef(name = "LastNumber",
typeClass = LastNumberType.class,
@TypeDef(typeClass = LastNumberType.class,
defaultForType = EntityEnum.LastNumber.class)
})
public class EntityEnum {