throws HibernateException {
}
private static Class<? extends EntityCopyObserver> determineEntityCopyObserverClass(
SessionFactoryImplementor sessionFactory) {
final ServiceRegistry serviceRegistry = sessionFactory.getServiceRegistry();
final ConfigurationService configurationService
= serviceRegistry.getService( ConfigurationService.class );
final String entityCopyObserverStrategyString = configurationService.getSetting(
ENTITY_COPY_OBSERVER_STRATEGY_PROPERTY_NAME,
new ConfigurationService.Converter<String>() {
@Override
public String convert(Object value) {
return value.toString();
}
},
EntityCopyNotAllowedObserver.SHORT_NAME
);
LOG.debugf( "EntityCopyObserver strategy: %s", entityCopyObserverStrategyString );
if ( EntityCopyNotAllowedObserver.SHORT_NAME.equals( entityCopyObserverStrategyString ) ) {
return EntityCopyNotAllowedObserver.class;
}
else if ( EntityCopyAllowedObserver.SHORT_NAME.equals( entityCopyObserverStrategyString ) ) {
return EntityCopyAllowedObserver.class;
}
else if ( EntityCopyAllowedLoggedObserver.SHORT_NAME.equals( entityCopyObserverStrategyString ) ) {
return EntityCopyAllowedLoggedObserver.class;
}
else {
final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
try {
return classLoaderService.classForName( entityCopyObserverStrategyString );
}
catch (ClassLoadingException e) {
throw new HibernateException(