|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.smartlab.web.BusinessObjectFactory
public abstract class BusinessObjectFactory
This class provides basic template for an Hibernate based implementation of the DAO pattern.
| Nested Class Summary | |
|---|---|
class |
BusinessObjectFactory.Paginator
TODO documentation |
| Nested classes/interfaces inherited from interface net.smartlab.web.DataAccessObject |
|---|
DataAccessObject.SearchInfo |
| Field Summary | |
|---|---|
protected org.hibernate.SessionFactory |
factory
Caches a reference to the Hibernate Session Factory to avoid further lookups. |
protected org.apache.commons.logging.Log |
logger
Provides logging capabilities to the factory. |
| Constructor Summary | |
|---|---|
protected |
BusinessObjectFactory()
Protected default constructor to allow subclassing. |
| Method Summary | |
|---|---|
void |
begin()
TODO documentation |
static void |
close()
Closes the connection to the persistence tier. |
void |
commit()
TODO documentation |
java.io.Serializable |
convertKey(java.io.Serializable key)
Converts a generic serializable object to the type used as unique key identifier for this type of BusinessObject. |
java.util.Set |
convertKeys(java.util.Collection keys)
Converts a generic set of serializable objects to a set containing objects of the type used as unique key identifier for this type of BusinessObject using the convertKey() method. |
org.hibernate.Criteria |
createCriteria(DataAccessObject.SearchInfo info)
Creates an Hibernate Criteria instance using filtering and
ordering rules defined through the SearchInfo structure. |
protected org.hibernate.Session |
current()
Returns the current Hibernate Session. |
java.lang.Object |
findByKey(java.io.Serializable key)
Retrieves from the persistence tier the object which primary key equals the one specified. |
java.lang.Object |
findByKey(java.io.Serializable key,
java.lang.String[] fetch)
|
static void |
flush()
|
abstract java.lang.Class |
getMappedClass()
TODO documentation |
java.util.Collection |
list(DataAccessObject.SearchInfo info)
Returns a collection of objects representing all the persistence tier informations matching the specified search criterias. |
java.util.Collection |
list(DataAccessObject.SearchInfo info,
java.lang.String[] fetch)
|
java.util.Collection |
listByKeySet(java.util.Set keys,
DataAccessObject.SearchInfo info)
Returns a collection of objects representing all the persistence tier informations matching the specified set of unique identification keys and search criterias. |
java.util.Collection |
listByKeySet(java.util.Set keys,
DataAccessObject.SearchInfo info,
boolean exclude)
Returns a collection of objects representing all the persistence tier informations matching the specified set of unique identification keys and search criterias. |
java.util.Collection |
listByKeySet(java.lang.String keyFieldName,
java.util.Set keys,
DataAccessObject.SearchInfo info)
Deprecated. the keyFieldName parameter is no more needed |
java.util.Collection |
page(DataAccessObject.SearchInfo info)
Returns a paginable collection of objects representing all the persistence tier informations matching the specified search criterias. |
java.util.Collection |
page(DataAccessObject.SearchInfo info,
java.lang.String[] fetch)
|
void |
remove(java.lang.Object object)
Permanently deletes an instance from the persistence tier. |
void |
rollback()
TODO documentation |
static void |
setConfigurationStrategy(FactoryConfigurationStrategy strategy)
Changes the strategy used to configure the framework. |
void |
update(java.lang.Object object)
Ensures the persistence tier representation of the object is consistent with the in memory representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
protected org.hibernate.SessionFactory factory
| Constructor Detail |
|---|
protected BusinessObjectFactory()
META-INF
directory of the topmost packaging archive and should be named
smartweb.jar.hcf or have the name of the JAR file containing
the subclass followed by the .hcf suffix. TODO example
| Method Detail |
|---|
public static void setConfigurationStrategy(FactoryConfigurationStrategy strategy)
strategy - an implementation of the
FactoryConfigurationStrategy interface.
public static void close()
throws DAOException
DAOException - if the persistence tier generates any error while
performing the resource release.
public static void flush()
throws DAOException
DAOException
protected org.hibernate.Session current()
throws DAOException
DAOException - if an error occurs trying to establish the
connection.
public java.lang.Object findByKey(java.io.Serializable key)
throws DAOException
DataAccessObject
findByKey in interface DataAccessObjectkey - the primary key used to search the instance into the
persistence tier.
DAOException - if an error occur while accessing the persistence
tier.
UndefinedKeyException - if the specified primary key is not present
on the persistence tier.DataAccessObject.findByKey(java.io.Serializable)
public java.lang.Object findByKey(java.io.Serializable key,
java.lang.String[] fetch)
throws DAOException
key - fetch -
DAOException
public void remove(java.lang.Object object)
throws DAOException
DataAccessObject
remove in interface DataAccessObjectobject - the instance representing the informations to be deleted
from the store.
DAOException - if an error occur while accessing the persistence
tier.DataAccessObject.remove(java.lang.Object)
public void update(java.lang.Object object)
throws DAOException
DataAccessObject
update in interface DataAccessObjectobject - the object to be persisted.
DAOException - if an error occur while accessing the persistence
tierDataAccessObject.update(java.lang.Object)
public java.util.Collection list(DataAccessObject.SearchInfo info)
throws DAOException
DataAccessObject
list in interface DataAccessObjectinfo - the criterias to be used to search the persistence tier.
DAOException - if an error occur while accessing the persistence
tierDataAccessObject.list(net.smartlab.web.DataAccessObject.SearchInfo)
public java.util.Collection list(DataAccessObject.SearchInfo info,
java.lang.String[] fetch)
throws DAOException
info - fetch -
DAOException
public java.util.Collection listByKeySet(java.util.Set keys,
DataAccessObject.SearchInfo info)
throws DAOException
keys - the set of keys to be matched.info - the additional criterias to be used to search the persistence
tier.
DAOException - if an error occur while accessing the persistence
tier
public java.util.Collection listByKeySet(java.lang.String keyFieldName,
java.util.Set keys,
DataAccessObject.SearchInfo info)
throws DAOException
keyFieldName - the fieldName to be matched for unique identification
key.keys - the set of keys to be matched.info - the additional criterias to be used to search the persistence
tier.
DAOException - if an error occur while accessing the persistence
tierlistByKeySet(java.util.Set, net.smartlab.web.DataAccessObject.SearchInfo, boolean)
public java.util.Collection listByKeySet(java.util.Set keys,
DataAccessObject.SearchInfo info,
boolean exclude)
throws DAOException
keys - the set of keys to be matched.info - the additional criterias to be used to search the persistence
tier.exclude - if the keys should be included or excluded from the list.
DAOException - if an error occur while accessing the persistence
tier
public java.util.Collection page(DataAccessObject.SearchInfo info)
throws DAOException
info - the criterias to be used filter the instances.
DAOException - if an error occur while accessing the persistence
tier
public java.util.Collection page(DataAccessObject.SearchInfo info,
java.lang.String[] fetch)
throws DAOException
info - fetch -
DAOExceptionpublic abstract java.lang.Class getMappedClass()
public java.io.Serializable convertKey(java.io.Serializable key)
o value to
identify non-persisted instances. If your business definition requires a
different conversion you should override this method to provide your own
conversion strategy.
key - the generic serializable key that needs to be converted.
null if the providen key doesn't represent a valid
identifier for a persisted BusinessObject.public java.util.Set convertKeys(java.util.Collection keys)
convertKey() method.
keys - the java.util.Set of serializable objects to be
converted.
java.util.Set containing appropriately converted
keys.
public org.hibernate.Criteria createCriteria(DataAccessObject.SearchInfo info)
throws DAOException
Criteria instance using filtering and
ordering rules defined through the SearchInfo structure.
info -
DAOException
public void begin()
throws DAOException
DAOException
public void commit()
throws DAOException
DAOException
public void rollback()
throws DAOException
DAOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||