HHH-7703: @TypeDefs processed, but not used
https://hibernate.onjira.com/browse/HHH-7703
This commit is contained in:
parent
567df233cc
commit
22b0203ea7
|
@ -365,14 +365,8 @@ public class Binder {
|
||||||
attributeSource.getNaturalIdMutability(),
|
attributeSource.getNaturalIdMutability(),
|
||||||
createMetaAttributeContext( attributeBindingContainer, attributeSource ),
|
createMetaAttributeContext( attributeBindingContainer, attributeSource ),
|
||||||
attributeSource.getGeneration() );
|
attributeSource.getGeneration() );
|
||||||
final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();
|
|
||||||
typeHelper.bindSingularAttributeTypeInformation( attributeSource,
|
typeHelper.bindSingularAttributeTypeInformation( attributeSource,
|
||||||
attributeBinding );
|
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;
|
return attributeBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.DuplicateMappingException;
|
import org.hibernate.DuplicateMappingException;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.annotations.common.util.StringHelper;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.cache.spi.access.AccessType;
|
import org.hibernate.cache.spi.access.AccessType;
|
||||||
import org.hibernate.cfg.NamingStrategy;
|
import org.hibernate.cfg.NamingStrategy;
|
||||||
|
@ -230,12 +231,12 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
|
||||||
if ( typeDefinition == null ) {
|
if ( typeDefinition == null ) {
|
||||||
throw new IllegalArgumentException( "Type definition is 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.
|
// Need to register both by name and registration keys.
|
||||||
|
if ( !StringHelper.isEmpty( typeDefinition.getName() ) ) {
|
||||||
addTypeDefinition( typeDefinition.getName(), typeDefinition );
|
addTypeDefinition( typeDefinition.getName(), typeDefinition );
|
||||||
|
}
|
||||||
|
|
||||||
for ( String registrationKey : typeDefinition.getRegistrationKeys() ) {
|
for ( String registrationKey : typeDefinition.getRegistrationKeys() ) {
|
||||||
addTypeDefinition( registrationKey, typeDefinition );
|
addTypeDefinition( registrationKey, typeDefinition );
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ import org.hibernate.annotations.TypeDefs;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@TypeDefs({
|
@TypeDefs({
|
||||||
@TypeDef(name = "LastNumber",
|
@TypeDef(typeClass = LastNumberType.class,
|
||||||
typeClass = LastNumberType.class,
|
|
||||||
defaultForType = EntityEnum.LastNumber.class)
|
defaultForType = EntityEnum.LastNumber.class)
|
||||||
})
|
})
|
||||||
public class EntityEnum {
|
public class EntityEnum {
|
||||||
|
|
Loading…
Reference in New Issue