public abstract class AbstractHibernateDatastore extends AbstractDatastore implements ApplicationContextAware, MultipleConnectionSourceCapableDatastore, SchemaMultiTenantCapableDatastore, Settings, TransactionCapableDatastore, java.io.Closeable, MessageSourceAware
Datastore implementation that uses a Hibernate SessionFactory underneath.
| Modifiers | Name | Description |
|---|---|---|
enum |
AbstractHibernateDatastore.FlushMode |
We use a separate enum here because the classes differ between Hibernate 3 and 4 |
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
CONFIG_PROPERTY_CACHE_QUERIES |
|
static java.lang.String |
CONFIG_PROPERTY_OSIV_READONLY |
|
static java.lang.String |
CONFIG_PROPERTY_PASS_READONLY_TO_HIBERNATE |
|
protected AutoTimestampEventListener |
autoTimestampEventListener |
|
protected ConnectionSources<org.hibernate.SessionFactory, HibernateConnectionSourceSettings> |
connectionSources |
|
protected java.lang.String |
dataSourceName |
|
protected int |
defaultFlushMode |
|
protected java.lang.String |
defaultFlushModeName |
|
protected AbstractHibernateEventListener |
eventTriggeringInterceptor |
|
protected boolean |
failOnError |
|
protected boolean |
isCacheQueries |
|
protected boolean |
markDirty |
|
protected MultiTenancyMode |
multiTenantMode |
|
protected boolean |
osivReadOnly |
|
protected boolean |
passReadOnlyToHibernate |
|
protected SchemaHandler |
schemaHandler |
|
protected org.hibernate.SessionFactory |
sessionFactory |
|
protected TenantResolver |
tenantResolver |
| Fields inherited from class | Fields |
|---|---|
class AbstractDatastore |
LOG, applicationEventPublisher, cacheAdapterRepository, connectionDetails, mappingContext, serviceRegistry |
| Constructor and description |
|---|
protected AbstractHibernateDatastore(ConnectionSources<org.hibernate.SessionFactory, HibernateConnectionSourceSettings> connectionSources, HibernateMappingContext mappingContext) |
protected AbstractHibernateDatastore(MappingContext mappingContext, org.hibernate.SessionFactory sessionFactory, PropertyResolver config, ApplicationContext applicationContext, java.lang.String dataSourceName) |
AbstractHibernateDatastore(MappingContext mappingContext, org.hibernate.SessionFactory sessionFactory, PropertyResolver config) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public T |
call(java.lang.Object args) |
|
public void |
close() |
|
protected ValidatorRegistry |
createValidatorRegistry(MessageSource messageSource) |
|
public void |
destroy() |
|
public void |
disableMultiTenancyFilter()Disable the tenant id filter for the given datastore and entity |
|
public void |
enableMultiTenancyFilter()Enable the tenant id filter for the given datastore and entity |
|
public AutoTimestampEventListener |
getAutoTimestampEventListener()
|
|
public ConnectionSources<org.hibernate.SessionFactory, HibernateConnectionSourceSettings> |
getConnectionSources() |
|
public javax.sql.DataSource |
getDataSource()
|
|
public java.lang.String |
getDataSourceName()
|
|
public abstract AbstractHibernateDatastore |
getDatastoreForConnection(java.lang.String connectionName)Obtain a child datastore for the given connection name |
|
public Datastore |
getDatastoreForTenantId(java.io.Serializable tenantId) |
|
public int |
getDefaultFlushMode()
|
|
public java.lang.String |
getDefaultFlushModeName()
|
|
public AbstractHibernateEventListener |
getEventTriggeringInterceptor() |
|
public abstract IHibernateTemplate |
getHibernateTemplate(int flushMode)Obtains a hibernate template for the given flush mode |
|
public IHibernateTemplate |
getHibernateTemplate()
|
|
public MultiTenancyMode |
getMultiTenancyMode() |
|
public org.hibernate.SessionFactory |
getSessionFactory()
|
|
public TenantResolver |
getTenantResolver() |
|
public boolean |
isAutoFlush() |
|
public boolean |
isCacheQueries() |
|
public boolean |
isFailOnError() |
|
public boolean |
isOsivReadOnly() |
|
public boolean |
isPassReadOnlyToHibernate() |
|
public abstract org.hibernate.Session |
openSession()
|
<T> |
protected Closure<T> |
prepareMultiTenantClosure(Closure<T> callable) |
|
public java.io.Serializable |
resolveTenantIdentifier() |
|
public java.lang.Iterable<java.io.Serializable> |
resolveTenantIds() |
|
public void |
setMessageSource(MessageSource messageSource) |
|
public abstract void |
withFlushMode(AbstractHibernateDatastore.FlushMode flushMode, java.util.concurrent.Callable<java.lang.Boolean> callable)Execute the given operation with the given flush mode. |
<T> |
public T |
withNewSession(Closure<T> callable) |
<T1> |
public T1 |
withNewSession(java.io.Serializable tenantId, Closure<T1> callable) |
<T> |
public T |
withSession(Closure<T> callable) |
| Methods inherited from class | Name |
|---|---|
class AbstractDatastore |
connect, connect, connectStateless, createSession, createStatelessSession, destroy, doInSession, getApplicationContext, getApplicationEventPublisher, getCurrentSession, getMappingContext, getService, getServices, getSessionResolver, hasCurrentSession, initializeConverters, isIndexed, isSchemaless, mapToPropertyResolver, retrieveSession, retrieveSession, setApplicationContext, withSession |
Disable the tenant id filter for the given datastore and entity
Enable the tenant id filter for the given datastore and entity
Obtain a child datastore for the given connection name
connectionName - The name of the connection
Obtains a hibernate template for the given flush mode
flushMode - The flush mode, one of the FLUSH_* constants of GrailsHibernateTemplate
Execute the given operation with the given flush mode. The previous flush mode of the current session is
restored afterwards, also when the operation throws, unless the operation returns false.
An exception thrown by the operation is rethrown; a checked exception is wrapped in an
java.lang.reflect.UndeclaredThrowableException.
flushMode - The flush mode to apply while the operation runscallable - The operation, which returns false to keep the given flush mode