Search in sources :

Example 1 with PersisterClassResolver

use of org.hibernate.persister.spi.PersisterClassResolver in project hibernate-orm by hibernate.

the class PersisterClassResolverInitiator method initiateService.

@Override
@SuppressWarnings({ "unchecked" })
public PersisterClassResolver initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    final Object customImpl = configurationValues.get(IMPL_NAME);
    if (customImpl == null) {
        return new StandardPersisterClassResolver();
    }
    if (PersisterClassResolver.class.isInstance(customImpl)) {
        return (PersisterClassResolver) customImpl;
    }
    final Class<? extends PersisterClassResolver> customImplClass = Class.class.isInstance(customImpl) ? (Class<? extends PersisterClassResolver>) customImpl : locate(registry, customImpl.toString());
    try {
        return customImplClass.newInstance();
    } catch (Exception e) {
        throw new ServiceException("Could not initialize custom PersisterClassResolver impl [" + customImplClass.getName() + "]", e);
    }
}
Also used : ServiceException(org.hibernate.service.spi.ServiceException) ServiceException(org.hibernate.service.spi.ServiceException) PersisterClassResolver(org.hibernate.persister.spi.PersisterClassResolver)

Aggregations

PersisterClassResolver (org.hibernate.persister.spi.PersisterClassResolver)1 ServiceException (org.hibernate.service.spi.ServiceException)1