Keel 2.1RC2

org.keel.services.persist.hibernate
Class HibernatePersistentFactory

java.lang.Object
  extended byorg.keel.core.container.AbstractKeelServiceable
      extended byorg.keel.services.persist.base.AbstractPersistentFactory
          extended byorg.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


Field Summary
private  net.sf.hibernate.cfg.Configuration hConfig
           
private  SessionFactory mySessionFactory
           
 
Fields inherited from class org.keel.services.persist.base.AbstractPersistentFactory
databaseType, dataSource, dataSourceName, keelContext, log, metas, myName, schemaDescrips, schemas
 
Fields inherited from class org.keel.core.container.AbstractKeelServiceable
 
Fields inherited from interface org.keel.services.persist.PersistentFactory
ROLE
 
Constructor Summary
HibernatePersistentFactory()
           
 
Method Summary
 Transaction begin()
          Begin a new transaction and pass the transaction back to the caller.
 Persistent create(java.lang.String name)
          Create a new persistent object with the specified name.
 void createIndices()
           
 void createIndices(java.lang.String schema)
           
private  Query createQuery(java.lang.String qstring)
           
 void createTables()
          Initialize all schemas defined in this persistent factory, creating all tables as required.
 void createTables(java.lang.String schemaName)
          Initialize the specified schema, creating all tables as required.
 void dropIndices()
           
 void dropIndices(java.lang.String schema)
           
private  Configuration getPropertiesConfiguration(java.lang.String key)
           
protected  SessionFactory getSessionFactory()
           
 void initialize()
          Initialize the component.
private  java.lang.String processedAttribValueX(java.lang.String attribValue)
           
private  java.lang.String propertyName(PersistentMetaData pmd, java.lang.String fieldName)
           
private  java.lang.String typeName(PersistentMetaData pmd, java.lang.String fieldName)
           
 
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 org.keel.core.container.AbstractKeelServiceable
getService, getService, getService, getService, getServiceManager, getServiceSelector, releaseService, releaseServices, service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hConfig

private net.sf.hibernate.cfg.Configuration hConfig

mySessionFactory

private SessionFactory mySessionFactory
Constructor Detail

HibernatePersistentFactory

public HibernatePersistentFactory()
Method Detail

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

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.