public abstract class AbstractHibernateDatastore extends org.grails.datastore.mapping.core.AbstractDatastore implements org.springframework.context.ApplicationContextAware, Settings, org.grails.datastore.mapping.multitenancy.SchemaMultiTenantCapableDatastore, org.grails.datastore.mapping.transactions.TransactionCapableDatastore, java.io.Closeable, org.springframework.context.MessageSourceAware, org.grails.datastore.mapping.core.connections.MultipleConnectionSourceCapableDatastore
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 org.grails.datastore.gorm.events.AutoTimestampEventListener |
autoTimestampEventListener |
|
protected org.grails.datastore.mapping.core.connections.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 org.grails.datastore.mapping.multitenancy.MultiTenancySettings$MultiTenancyMode |
multiTenantMode |
|
protected boolean |
osivReadOnly |
|
protected boolean |
passReadOnlyToHibernate |
|
protected org.grails.datastore.gorm.jdbc.schema.SchemaHandler |
schemaHandler |
|
protected org.hibernate.SessionFactory |
sessionFactory |
|
protected org.grails.datastore.mapping.multitenancy.TenantResolver |
tenantResolver |
| Constructor and description |
|---|
protected AbstractHibernateDatastore(org.grails.datastore.mapping.core.connections.ConnectionSources<org.hibernate.SessionFactory, HibernateConnectionSourceSettings> connectionSources, HibernateMappingContext mappingContext) |
protected AbstractHibernateDatastore(org.grails.datastore.mapping.model.MappingContext mappingContext, org.hibernate.SessionFactory sessionFactory, org.springframework.core.env.PropertyResolver config, org.springframework.context.ApplicationContext applicationContext, java.lang.String dataSourceName) |
AbstractHibernateDatastore(org.grails.datastore.mapping.model.MappingContext mappingContext, org.hibernate.SessionFactory sessionFactory, org.springframework.core.env.PropertyResolver config) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public T |
call(java.lang.Object args) |
|
public void |
close() |
|
protected org.grails.datastore.mapping.validation.ValidatorRegistry |
createValidatorRegistry(org.springframework.context.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 org.grails.datastore.gorm.events.AutoTimestampEventListener |
getAutoTimestampEventListener()
|
|
public org.grails.datastore.mapping.core.connections.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 org.grails.datastore.mapping.core.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 org.grails.datastore.mapping.multitenancy.MultiTenancySettings$MultiTenancyMode |
getMultiTenancyMode() |
|
public org.hibernate.SessionFactory |
getSessionFactory()
|
|
public org.grails.datastore.mapping.multitenancy.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 groovy.lang.Closure<T> |
prepareMultiTenantClosure(groovy.lang.Closure<T> callable) |
|
public java.io.Serializable |
resolveTenantIdentifier() |
|
public java.lang.Iterable<java.io.Serializable> |
resolveTenantIds() |
|
public void |
setMessageSource(org.springframework.context.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(groovy.lang.Closure<T> callable) |
<T1> |
public T1 |
withNewSession(java.io.Serializable tenantId, groovy.lang.Closure<T1> callable) |
<T> |
public T |
withSession(groovy.lang.Closure<T> callable) |
| Methods inherited from class | Name |
|---|---|
class org.grails.datastore.mapping.core.AbstractDatastore |
org.grails.datastore.mapping.core.AbstractDatastore#connect(), org.grails.datastore.mapping.core.AbstractDatastore#connect(org.springframework.core.env.PropertyResolver), org.grails.datastore.mapping.core.AbstractDatastore#connectStateless(), org.grails.datastore.mapping.core.AbstractDatastore#destroy(), org.grails.datastore.mapping.core.AbstractDatastore#equals(java.lang.Object), org.grails.datastore.mapping.core.AbstractDatastore#getApplicationContext(), org.grails.datastore.mapping.core.AbstractDatastore#getApplicationEventPublisher(), org.grails.datastore.mapping.core.AbstractDatastore#getClass(), org.grails.datastore.mapping.core.AbstractDatastore#getCurrentSession(), org.grails.datastore.mapping.core.AbstractDatastore#getMappingContext(), org.grails.datastore.mapping.core.AbstractDatastore#getService(java.lang.Class), org.grails.datastore.mapping.core.AbstractDatastore#getServices(), org.grails.datastore.mapping.core.AbstractDatastore#getSessionResolver(), org.grails.datastore.mapping.core.AbstractDatastore#hasCurrentSession(), org.grails.datastore.mapping.core.AbstractDatastore#hashCode(), org.grails.datastore.mapping.core.AbstractDatastore#isSchemaless(), org.grails.datastore.mapping.core.AbstractDatastore#notify(), org.grails.datastore.mapping.core.AbstractDatastore#notifyAll(), org.grails.datastore.mapping.core.AbstractDatastore#retrieveSession(), org.grails.datastore.mapping.core.AbstractDatastore#retrieveSession(java.lang.Class), org.grails.datastore.mapping.core.AbstractDatastore#setApplicationContext(org.springframework.context.ApplicationContext), org.grails.datastore.mapping.core.AbstractDatastore#toString(), org.grails.datastore.mapping.core.AbstractDatastore#wait(), org.grails.datastore.mapping.core.AbstractDatastore#wait(long), org.grails.datastore.mapping.core.AbstractDatastore#wait(long, int), org.grails.datastore.mapping.core.AbstractDatastore#withSession(groovy.lang.Closure) |
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