org.keel.services.persist.hibernate
Class HibernatePersistentFactory
java.lang.Object
org.keel.core.container.AbstractKeelServiceable
org.keel.services.persist.base.AbstractPersistentFactory
org.keel.services.persist.hibernate.HibernatePersistentFactory
- All Implemented Interfaces:
- Configurable, Disposable, Initializable, KeelContextualizable, LogEnabled, PersistentFactory, Poolable, Recyclable, Serviceable
- public class HibernatePersistentFactory
- extends AbstractPersistentFactory
A PersistentFactory is a class that generates new Persistent objects, Transactions, and Queries. One-to-one mapping to a SessionFactory in Hibernate
| Methods inherited from class org.keel.services.persist.base.AbstractPersistentFactory |
addInputs, addOutputs, addPersistentToOutput, addQuery, addQuery, configure, create, createRecords, dispose, enableLogging, getByPassAuthManager, getConfiguration, getFactory, getInstanceIdentifier, getKeelContext, getMetaData, getName, getPersistents, getSchemaConfiguration, getSchemaDescription, getSchemas, getSecurity, isConfigured, recycle, setKeelContext, setName |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
hConfig
private net.sf.hibernate.cfg.Configuration hConfig
-
mySessionFactory
private SessionFactory mySessionFactory
-
HibernatePersistentFactory
public HibernatePersistentFactory()
getSessionFactory
protected SessionFactory getSessionFactory()
-
getPropertiesConfiguration
private Configuration getPropertiesConfiguration(java.lang.String key)
-
initialize
public void initialize()
throws PersistenceException
- Description copied from interface:
Initializable
-
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.
-
- Specified by:
initialize in interface Initializable
- Overrides:
initialize in class AbstractPersistentFactory
-
- Throws:
PersistenceException
create
public Persistent create(java.lang.String name)
throws PersistenceException
-
Create a new persistent object with the specified name. The name must be of the form "schema.persistent".
-
- Specified by:
create in interface PersistentFactory
- Specified by:
create in class AbstractPersistentFactory
-
- Throws:
PersistenceException
begin
public Transaction begin()
throws PersistenceException
-
Begin a new transaction and pass the transaction back to the caller. Used when we want a number of database operations to be processed in a single transaction.
-
- Specified by:
begin in interface PersistentFactory
- Specified by:
begin in class AbstractPersistentFactory
-
- Throws:
PersistenceException
createTables
public void createTables(java.lang.String schemaName)
throws PersistenceException
-
Initialize the specified schema, creating all tables as required. Logs any differences between existing tables and specified tables.
-
- Specified by:
createTables in interface PersistentFactory
- Specified by:
createTables in class AbstractPersistentFactory
-
- Throws:
PersistenceException
createTables
public void createTables()
throws PersistenceException
-
Initialize all schemas defined in this persistent factory, creating all tables as required. Logs any differences between existing tables and specified tables.
-
- Specified by:
createTables in interface PersistentFactory
- Specified by:
createTables in class AbstractPersistentFactory
-
- Throws:
PersistenceException
createQuery
private Query createQuery(java.lang.String qstring)
throws java.sql.SQLException
-
- Throws:
java.sql.SQLException
processedAttribValueX
private java.lang.String processedAttribValueX(java.lang.String attribValue)
throws PersistenceException
-
- Parameters:
attribValue -
- Returns:
- Throws:
PersistenceException
createIndices
public void createIndices()
throws PersistenceException
-
- Specified by:
createIndices in class AbstractPersistentFactory
-
- Throws:
PersistenceException
createIndices
public void createIndices(java.lang.String schema)
throws PersistenceException
-
- Specified by:
createIndices in class AbstractPersistentFactory
-
- Throws:
PersistenceException
dropIndices
public void dropIndices()
throws PersistenceException
-
- Specified by:
dropIndices in class AbstractPersistentFactory
-
- Throws:
PersistenceException
dropIndices
public void dropIndices(java.lang.String schema)
throws PersistenceException
-
- Specified by:
dropIndices in class AbstractPersistentFactory
-
- Throws:
PersistenceException
propertyName
private java.lang.String propertyName(PersistentMetaData pmd,
java.lang.String fieldName)
throws PersistenceException
-
- Throws:
PersistenceException
typeName
private java.lang.String typeName(PersistentMetaData pmd,
java.lang.String fieldName)
throws PersistenceException
-
- Throws:
PersistenceException
Please see keelframework.org for information about new Keel releases.