HHH-5916 Expose persister class provider via Ejb3Configuration

This commit is contained in:
Emmanuel Bernard 2011-02-14 14:00:39 +01:00
parent d5d492744f
commit 876d613974
2 changed files with 22 additions and 0 deletions

View File

@ -246,6 +246,11 @@ public class AvailableSettings {
*/
public static final String NAMING_STRATEGY = "hibernate.ejb.naming_strategy";
/**
* PersisterClassProvider class name, the class has to gave a no-arg constructor
*/
public static final String PERSISTER_CLASS_PROVIDER = "hibernate.ejb.persister_class_provider";
/**
* Event configuration should follow the following pattern
* hibernate.ejb.event.[eventType] f.q.c.n.EventListener1, f.q.c.n.EventListener12 ...

View File

@ -90,6 +90,7 @@ import org.hibernate.engine.FilterDefinition;
import org.hibernate.event.EventListeners;
import org.hibernate.mapping.AuxiliaryDatabaseObject;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.persister.PersisterClassProvider;
import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.secure.JACCConfiguration;
import org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator;
@ -1048,6 +1049,17 @@ public class Ejb3Configuration implements Serializable, Referenceable {
cfg.setNamingStrategy( namingStrategy );
}
final PersisterClassProvider persisterClassProvider = instantiateCustomClassFromConfiguration(
preparedProperties,
null,
cfg.getPersisterClassProvider(),
AvailableSettings.PERSISTER_CLASS_PROVIDER,
"persister class provider",
PersisterClassProvider.class
);
if ( persisterClassProvider != null ) {
cfg.setPersisterClassProvider( persisterClassProvider );
}
if ( jaccKeys.size() > 0 ) {
addSecurity( jaccKeys, preparedProperties, workingVars );
@ -1569,6 +1581,11 @@ public class Ejb3Configuration implements Serializable, Referenceable {
return this;
}
public Ejb3Configuration setPersisterClassProvider(PersisterClassProvider persisterClassProvider) {
cfg.setPersisterClassProvider( persisterClassProvider );
return this;
}
public void setListeners(String type, String[] listenerClasses) {
cfg.setListeners( type, listenerClasses );
}