Search in sources :

Example 6 with AttributeConverter

use of javax.persistence.AttributeConverter 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<AttributeConverter> converterClass = cls.classForName(converterClassName);
            attributeConverterDescriptor = new AttributeConverterDescriptorNonAutoApplicableImpl(converterClass.newInstance());
            return;
        } catch (Exception e) {
            log.logBadHbmAttributeConverterType(typeName, e.getMessage());
        }
    }
    this.typeName = typeName;
}
Also used : AttributeConverter(javax.persistence.AttributeConverter) AttributeConverterDescriptorNonAutoApplicableImpl(org.hibernate.boot.internal.AttributeConverterDescriptorNonAutoApplicableImpl) MappingException(org.hibernate.MappingException) ClassLoadingException(org.hibernate.boot.registry.classloading.spi.ClassLoadingException) ClassLoaderService(org.hibernate.boot.registry.classloading.spi.ClassLoaderService)

Aggregations

AttributeConverter (javax.persistence.AttributeConverter)6 ClassLoaderService (org.hibernate.boot.registry.classloading.spi.ClassLoaderService)2 ResolvedType (com.fasterxml.classmate.ResolvedType)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Converter (javax.persistence.Converter)1 AnnotationException (org.hibernate.AnnotationException)1 MappingException (org.hibernate.MappingException)1 QueryException (org.hibernate.QueryException)1 MappingException (org.hibernate.boot.MappingException)1 UrlInputStreamAccess (org.hibernate.boot.archive.internal.UrlInputStreamAccess)1 ClassDescriptor (org.hibernate.boot.archive.scan.spi.ClassDescriptor)1 MappingFileDescriptor (org.hibernate.boot.archive.scan.spi.MappingFileDescriptor)1 PackageDescriptor (org.hibernate.boot.archive.scan.spi.PackageDescriptor)1 ScanEnvironment (org.hibernate.boot.archive.scan.spi.ScanEnvironment)1 AttributeConverterDescriptorNonAutoApplicableImpl (org.hibernate.boot.internal.AttributeConverterDescriptorNonAutoApplicableImpl)1 Origin (org.hibernate.boot.jaxb.Origin)1 ClassLoadingException (org.hibernate.boot.registry.classloading.spi.ClassLoadingException)1