public final class HibernateConfigurator extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HibernateConfigurator.Mode
Defines the database update mode (hibernate.hbm2ddl.auto).
|
| Constructor and Description |
|---|
HibernateConfigurator() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addClasses(Class<?>... classes)
Must be called before one of the "initialize" methods gets called, to register
all POJO classes that need to be configured with Hibernate.
|
static void |
enableBeforeImages(boolean yes) |
static void |
enableObservableCollections(boolean yes) |
static to.etc.webapp.query.QDataContextFactory |
getDataContextFactory()
Returns the data context factory wrapping the hibernate code.
|
static DataSource |
getDataSource()
Return the datasource, as configured.
|
static org.hibernate.SessionFactory |
getSessionFactory()
Return the Hibernate SessionFactory created by this code.
|
static void |
initialize(DataSource ds)
Main worker to initialize the database layer, using Hibernate, with a user-specified core data source.
|
static void |
initialize(File poolfile,
String poolname)
Initialize the layer using a poolid in the specified poolfile.
|
static void |
initialize(String poolname)
Alternate entrypoint: initialize the layer using a poolID in the default poolfile.
|
static org.hibernate.Session |
internalGetSession(to.etc.webapp.query.QDataContext dc)
Unwrap the QDataContext and obtain it's Hibernate
Session record. |
static void |
registerQueryExecutor(to.etc.webapp.query.IQueryExecutorFactory qexecutor)
Register an alternative
IQueryExecutorFactory which can execute QCriteria queries on non-hibernate
classes. |
static void |
registerQueryListener(to.etc.webapp.query.IQueryListener ql)
Register a DomUI
IQueryListener that will be called when DomUI executes QCriteria queries. |
static void |
schemaUpdate(HibernateConfigurator.Mode m)
Set the "schema update" mode for Hibernate (corresponding to hbm2ddl.auto).
|
static void |
showSQL(boolean on)
Set the "show sql" setting for hibernate.
|
@Nonnull public static DataSource getDataSource()
public static org.hibernate.SessionFactory getSessionFactory()
public static org.hibernate.Session internalGetSession(to.etc.webapp.query.QDataContext dc)
throws Exception
Session record.dc - Exceptionpublic static to.etc.webapp.query.QDataContextFactory getDataContextFactory()
public static void addClasses(Class<?>... classes)
public static void showSQL(boolean on)
on - public static void schemaUpdate(@Nonnull HibernateConfigurator.Mode m)
m - public static void registerQueryListener(to.etc.webapp.query.IQueryListener ql)
IQueryListener that will be called when DomUI executes QCriteria queries.ql - public static void registerQueryExecutor(to.etc.webapp.query.IQueryExecutorFactory qexecutor)
IQueryExecutorFactory which can execute QCriteria queries on non-hibernate
classes. WARNING: if
you use this call all default query executors are not registered. This allows you to override them if needed. It also
means that no Hibernate QCriteria code works at all if you do not add them! The default factories should be registered
as follows:
registerQueryListener(JdbcQueryExecutor.FACTORY); registerQueryListener(HibernateQueryExecutor.FACTORY);By ordering your executors with the default ones you can control the order of acceptance for queries.
qexecutor - public static void enableBeforeImages(boolean yes)
public static void enableObservableCollections(boolean yes)
public static void initialize(DataSource ds) throws Exception
ds - Exceptionpublic static void initialize(String poolname) throws Exception
poolname - ExceptionCopyright © 2017 etc.to. All rights reserved.