Search in sources :

Example 1 with ClassBasedConverterDescriptor

use of org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor in project hibernate-orm by hibernate.

the class SimpleValue method setTypeName.

public void setTypeName(String typeName) {
    if (typeName != null && typeName.startsWith(AttributeConverterTypeAdapter.NAME_PREFIX)) {
        final String converterClassName = typeName.substring(AttributeConverterTypeAdapter.NAME_PREFIX.length());
        final ClassLoaderService cls = getMetadata().getMetadataBuildingOptions().getServiceRegistry().getService(ClassLoaderService.class);
        try {
            final Class<? extends AttributeConverter> converterClass = cls.classForName(converterClassName);
            this.attributeConverterDescriptor = new ClassBasedConverterDescriptor(converterClass, false, ((InFlightMetadataCollector) getMetadata()).getClassmateContext());
            return;
        } catch (Exception e) {
            log.logBadHbmAttributeConverterType(typeName, e.getMessage());
        }
    }
    this.typeName = typeName;
}
Also used : InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) ClassBasedConverterDescriptor(org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor) MappingException(org.hibernate.MappingException) ClassLoadingException(org.hibernate.boot.registry.classloading.spi.ClassLoadingException) ClassLoaderService(org.hibernate.boot.registry.classloading.spi.ClassLoaderService)

Aggregations

MappingException (org.hibernate.MappingException)1 ClassBasedConverterDescriptor (org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor)1 ClassLoaderService (org.hibernate.boot.registry.classloading.spi.ClassLoaderService)1 ClassLoadingException (org.hibernate.boot.registry.classloading.spi.ClassLoadingException)1 InFlightMetadataCollector (org.hibernate.boot.spi.InFlightMetadataCollector)1