asit.moa.moazs.notifier
Class _BaseRootDAO

java.lang.Object
  extended byasit.moa.moazs.notifier._BaseRootDAO
Direct Known Subclasses:
_RootDAO

public abstract class _BaseRootDAO
extends Object


Field Summary
protected static ThreadLocal mappedSessions
           
protected static net.sf.hibernate.SessionFactory sessionFactory
           
protected static Map sessionFactoryMap
           
protected static ThreadLocal sessions
           
 
Constructor Summary
_BaseRootDAO()
           
 
Method Summary
 net.sf.hibernate.Transaction beginTransaction(net.sf.hibernate.Session s)
          Begin the transaction related to the session
static void closeCurrentThreadSessions()
          Close all sessions for the current thread
 void closeSession(net.sf.hibernate.Session session)
          Close the session
 void commitTransaction(net.sf.hibernate.Transaction t)
          Commit the given transaction
 net.sf.hibernate.Session createNewSession()
          Return a new Session object that must be closed when the work has been completed.
protected  void delete(Object obj)
          Used by the base DAO classes but here for your modification Remove a persistent instance from the datastore.
protected  void delete(Object obj, net.sf.hibernate.Session s)
          Used by the base DAO classes but here for your modification Remove a persistent instance from the datastore.
protected  int delete(net.sf.hibernate.Query query)
          Delete all objects returned by the query
protected  int delete(net.sf.hibernate.Query query, net.sf.hibernate.Session s)
          Delete all objects returned by the query
 List findAll()
          Return all objects related to the implementation of this DAO with no filter.
 List findAll(net.sf.hibernate.expression.Order defaultOrder)
          Return all objects related to the implementation of this DAO with no filter.
 List findAll(net.sf.hibernate.Session s)
          Return all objects related to the implementation of this DAO with no filter.
 List findAll(net.sf.hibernate.Session s, net.sf.hibernate.expression.Order defaultOrder)
          Return all objects related to the implementation of this DAO with no filter.
protected  List findFiltered(net.sf.hibernate.Session s, String propName, Object filter, net.sf.hibernate.expression.Order order)
          Return all objects related to the implementation of this DAO with a filter.
protected  List findFiltered(String propName, Object filter)
          Return all objects related to the implementation of this DAO with a filter.
protected  List findFiltered(String propName, Object filter, net.sf.hibernate.expression.Order order)
          Return all objects related to the implementation of this DAO with a filter.
protected  Object get(Class refClass, Serializable key)
          Used by the base DAO classes but here for your modification Get object matching the given key and return it.
protected  Object get(Class refClass, Serializable key, net.sf.hibernate.Session s)
          Used by the base DAO classes but here for your modification Get object matching the given key and return it.
 String getConfigurationFileName()
          Return the name of the configuration file to be used with this DAO or null if default
protected  net.sf.hibernate.expression.Order getDefaultOrder()
           
protected  net.sf.hibernate.Query getNamedQuery(String name)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getNamedQuery(String name, Map params)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getNamedQuery(String name, Map params, net.sf.hibernate.Session s)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getNamedQuery(String name, Serializable param)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getNamedQuery(String name, Serializable[] params)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getNamedQuery(String name, Serializable[] params, net.sf.hibernate.Session s)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getNamedQuery(String name, Serializable param, net.sf.hibernate.Session s)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getNamedQuery(String name, net.sf.hibernate.Session s)
          Obtain an instance of Query for a named query string defined in the mapping file.
static net.sf.hibernate.cfg.Configuration getNewConfiguration(String configFileName)
          Return a new Configuration to use
 net.sf.hibernate.Query getQuery(String queryStr)
          Execute a query.
protected  net.sf.hibernate.Query getQuery(String queryStr, Map params)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getQuery(String queryStr, Map params, net.sf.hibernate.Session s)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  net.sf.hibernate.Query getQuery(String queryStr, Serializable param)
          Execute a query.
protected  net.sf.hibernate.Query getQuery(String queryStr, Serializable[] params)
          Execute a query.
protected  net.sf.hibernate.Query getQuery(String queryStr, Serializable[] params, net.sf.hibernate.Session s)
          Execute a query but use the session given instead of creating a new one.
protected  net.sf.hibernate.Query getQuery(String queryStr, Serializable param, net.sf.hibernate.Session s)
          Execute a query but use the session given instead of creating a new one.
 net.sf.hibernate.Query getQuery(String queryStr, net.sf.hibernate.Session s)
          Execute a query but use the session given instead of creating a new one.
protected abstract  Class getReferenceClass()
          Return the specific Object class that will be used for class-specific implementation of this DAO.
 net.sf.hibernate.Session getSession()
          Return a new Session object that must be closed when the work has been completed.
protected  net.sf.hibernate.SessionFactory getSessionFactory()
          Return the SessionFactory that is to be used by these DAOs.
protected  net.sf.hibernate.SessionFactory getSessionFactory(String configFile)
           
static void initialize()
          Configure the session factory by reading hibernate config file
static void initialize(String configFileName)
          Configure the session factory by reading hibernate config file
static void initialize(String configFileName, net.sf.hibernate.cfg.Configuration configuration)
           
protected  Object load(Class refClass, Serializable key)
          Used by the base DAO classes but here for your modification Load object matching the given key and return it.
protected  Object load(Class refClass, Serializable key, net.sf.hibernate.Session s)
          Used by the base DAO classes but here for your modification Load object matching the given key and return it.
protected  void refresh(Object obj, net.sf.hibernate.Session s)
          Used by the base DAO classes but here for your modification Re-read the state of the given instance from the underlying database.
protected  Serializable save(Object obj)
          Used by the base DAO classes but here for your modification Persist the given transient instance, first assigning a generated identifier.
protected  Serializable save(Object obj, net.sf.hibernate.Session s)
          Used by the base DAO classes but here for your modification Persist the given transient instance, first assigning a generated identifier.
protected  void saveOrUpdate(Object obj)
          Used by the base DAO classes but here for your modification Either save() or update() the given instance, depending upon the value of its identifier property.
protected  void saveOrUpdate(Object obj, net.sf.hibernate.Session s)
          Used by the base DAO classes but here for your modification Either save() or update() the given instance, depending upon the value of its identifier property.
protected static void setSessionFactory(net.sf.hibernate.SessionFactory sessionFactory)
          Set the session factory
protected static void setSessionFactory(String configFileName, net.sf.hibernate.SessionFactory sf)
          Set the session factory
protected  void update(Object obj)
          Used by the base DAO classes but here for your modification Update the persistent state associated with the given identifier.
protected  void update(Object obj, net.sf.hibernate.Session s)
          Used by the base DAO classes but here for your modification Update the persistent state associated with the given identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionFactoryMap

protected static Map sessionFactoryMap

sessionFactory

protected static net.sf.hibernate.SessionFactory sessionFactory

mappedSessions

protected static ThreadLocal mappedSessions

sessions

protected static ThreadLocal sessions
Constructor Detail

_BaseRootDAO

public _BaseRootDAO()
Method Detail

initialize

public static void initialize()
                       throws net.sf.hibernate.HibernateException
Configure the session factory by reading hibernate config file

Throws:
net.sf.hibernate.HibernateException

initialize

public static void initialize(String configFileName)
                       throws net.sf.hibernate.HibernateException
Configure the session factory by reading hibernate config file

Parameters:
configFileName - the name of the configuration file
Throws:
net.sf.hibernate.HibernateException

initialize

public static void initialize(String configFileName,
                              net.sf.hibernate.cfg.Configuration configuration)
                       throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

setSessionFactory

protected static void setSessionFactory(net.sf.hibernate.SessionFactory sessionFactory)
Set the session factory


setSessionFactory

protected static void setSessionFactory(String configFileName,
                                        net.sf.hibernate.SessionFactory sf)
Set the session factory


getSessionFactory

protected net.sf.hibernate.SessionFactory getSessionFactory()
Return the SessionFactory that is to be used by these DAOs. Change this and implement your own strategy if you, for example, want to pull the SessionFactory from the JNDI tree.


getSessionFactory

protected net.sf.hibernate.SessionFactory getSessionFactory(String configFile)

getSession

public net.sf.hibernate.Session getSession()
                                    throws net.sf.hibernate.HibernateException
Return a new Session object that must be closed when the work has been completed.

Returns:
the active Session
Throws:
net.sf.hibernate.HibernateException

createNewSession

public net.sf.hibernate.Session createNewSession()
                                          throws net.sf.hibernate.HibernateException
Return a new Session object that must be closed when the work has been completed.

Returns:
the active Session
Throws:
net.sf.hibernate.HibernateException

closeCurrentThreadSessions

public static void closeCurrentThreadSessions()
                                       throws net.sf.hibernate.HibernateException
Close all sessions for the current thread

Throws:
net.sf.hibernate.HibernateException

closeSession

public void closeSession(net.sf.hibernate.Session session)
                  throws net.sf.hibernate.HibernateException
Close the session

Throws:
net.sf.hibernate.HibernateException

beginTransaction

public net.sf.hibernate.Transaction beginTransaction(net.sf.hibernate.Session s)
                                              throws net.sf.hibernate.HibernateException
Begin the transaction related to the session

Throws:
net.sf.hibernate.HibernateException

commitTransaction

public void commitTransaction(net.sf.hibernate.Transaction t)
                       throws net.sf.hibernate.HibernateException
Commit the given transaction

Throws:
net.sf.hibernate.HibernateException

getNewConfiguration

public static net.sf.hibernate.cfg.Configuration getNewConfiguration(String configFileName)
Return a new Configuration to use


getConfigurationFileName

public String getConfigurationFileName()
Return the name of the configuration file to be used with this DAO or null if default


getReferenceClass

protected abstract Class getReferenceClass()
Return the specific Object class that will be used for class-specific implementation of this DAO.

Returns:
the reference Class

get

protected Object get(Class refClass,
                     Serializable key)
              throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Get object matching the given key and return it.

Throws:
net.sf.hibernate.HibernateException

get

protected Object get(Class refClass,
                     Serializable key,
                     net.sf.hibernate.Session s)
              throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Get object matching the given key and return it.

Throws:
net.sf.hibernate.HibernateException

load

protected Object load(Class refClass,
                      Serializable key)
               throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Load object matching the given key and return it.

Throws:
net.sf.hibernate.HibernateException

load

protected Object load(Class refClass,
                      Serializable key,
                      net.sf.hibernate.Session s)
               throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Load object matching the given key and return it.

Throws:
net.sf.hibernate.HibernateException

findAll

public List findAll()
             throws net.sf.hibernate.HibernateException
Return all objects related to the implementation of this DAO with no filter.

Throws:
net.sf.hibernate.HibernateException

findAll

public List findAll(net.sf.hibernate.Session s)
             throws net.sf.hibernate.HibernateException
Return all objects related to the implementation of this DAO with no filter. Use the session given.

Parameters:
s - the Session
Throws:
net.sf.hibernate.HibernateException

findAll

public List findAll(net.sf.hibernate.expression.Order defaultOrder)
             throws net.sf.hibernate.HibernateException
Return all objects related to the implementation of this DAO with no filter.

Throws:
net.sf.hibernate.HibernateException

findAll

public List findAll(net.sf.hibernate.Session s,
                    net.sf.hibernate.expression.Order defaultOrder)
             throws net.sf.hibernate.HibernateException
Return all objects related to the implementation of this DAO with no filter. Use the session given.

Parameters:
s - the Session
Throws:
net.sf.hibernate.HibernateException

findFiltered

protected List findFiltered(String propName,
                            Object filter)
                     throws net.sf.hibernate.HibernateException
Return all objects related to the implementation of this DAO with a filter. Use the session given.

Parameters:
propName - the name of the property to use for filtering
filter - the value of the filter
Throws:
net.sf.hibernate.HibernateException

findFiltered

protected List findFiltered(String propName,
                            Object filter,
                            net.sf.hibernate.expression.Order order)
                     throws net.sf.hibernate.HibernateException
Return all objects related to the implementation of this DAO with a filter. Use the session given.

Parameters:
propName - the name of the property to use for filtering
filter - the value of the filter
Throws:
net.sf.hibernate.HibernateException

findFiltered

protected List findFiltered(net.sf.hibernate.Session s,
                            String propName,
                            Object filter,
                            net.sf.hibernate.expression.Order order)
                     throws net.sf.hibernate.HibernateException
Return all objects related to the implementation of this DAO with a filter. Use the session given.

Parameters:
s - the Session
propName - the name of the property to use for filtering
filter - the value of the filter
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file.

Parameters:
name - the name of a query defined externally
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name,
                                               net.sf.hibernate.Session s)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the session given.

Parameters:
name - the name of a query defined externally
s - the Session
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name,
                                               Serializable param)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file.

Parameters:
name - the name of a query defined externally
param - the first parameter to set
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name,
                                               Serializable param,
                                               net.sf.hibernate.Session s)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the session given.

Parameters:
name - the name of a query defined externally
param - the first parameter to set
s - the Session
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name,
                                               Serializable[] params)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.

Parameters:
name - the name of a query defined externally
params - the parameter array
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name,
                                               Serializable[] params,
                                               net.sf.hibernate.Session s)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given and the Session given.

Parameters:
name - the name of a query defined externally
params - the parameter array
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name,
                                               Map params)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.

Parameters:
name - the name of a query defined externally
params - the parameter Map
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getNamedQuery

protected net.sf.hibernate.Query getNamedQuery(String name,
                                               Map params,
                                               net.sf.hibernate.Session s)
                                        throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given and the Session given.

Parameters:
name - the name of a query defined externally
params - the parameter Map
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getQuery

public net.sf.hibernate.Query getQuery(String queryStr)
                                throws net.sf.hibernate.HibernateException
Execute a query.

Parameters:
queryStr - a query expressed in Hibernate's query language
Returns:
a distinct list of instances (or arrays of instances)
Throws:
net.sf.hibernate.HibernateException

getQuery

public net.sf.hibernate.Query getQuery(String queryStr,
                                       net.sf.hibernate.Session s)
                                throws net.sf.hibernate.HibernateException
Execute a query but use the session given instead of creating a new one.

Parameters:
queryStr - a query expressed in Hibernate's query language
Throws:
net.sf.hibernate.HibernateException

getQuery

protected net.sf.hibernate.Query getQuery(String queryStr,
                                          Serializable param)
                                   throws net.sf.hibernate.HibernateException
Execute a query.

Parameters:
queryStr - the name of a query defined externally
param - the first parameter to set
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getQuery

protected net.sf.hibernate.Query getQuery(String queryStr,
                                          Serializable param,
                                          net.sf.hibernate.Session s)
                                   throws net.sf.hibernate.HibernateException
Execute a query but use the session given instead of creating a new one.

Parameters:
queryStr - a query expressed in Hibernate's query language
param - the first parameter to set
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getQuery

protected net.sf.hibernate.Query getQuery(String queryStr,
                                          Serializable[] params)
                                   throws net.sf.hibernate.HibernateException
Execute a query.

Parameters:
queryStr - a query expressed in Hibernate's query language
params - the parameter array
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getQuery

protected net.sf.hibernate.Query getQuery(String queryStr,
                                          Serializable[] params,
                                          net.sf.hibernate.Session s)
                                   throws net.sf.hibernate.HibernateException
Execute a query but use the session given instead of creating a new one.

Parameters:
queryStr - a query expressed in Hibernate's query language
params - the parameter array
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getQuery

protected net.sf.hibernate.Query getQuery(String queryStr,
                                          Map params)
                                   throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.

Parameters:
queryStr - a query expressed in Hibernate's query language
params - the parameter Map
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getQuery

protected net.sf.hibernate.Query getQuery(String queryStr,
                                          Map params,
                                          net.sf.hibernate.Session s)
                                   throws net.sf.hibernate.HibernateException
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given and the Session given.

Parameters:
queryStr - a query expressed in Hibernate's query language
params - the parameter Map
Returns:
Query
Throws:
net.sf.hibernate.HibernateException

getDefaultOrder

protected net.sf.hibernate.expression.Order getDefaultOrder()

save

protected Serializable save(Object obj)
                     throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.)

Throws:
net.sf.hibernate.HibernateException

save

protected Serializable save(Object obj,
                            net.sf.hibernate.Session s)
                     throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.)

Throws:
net.sf.hibernate.HibernateException

saveOrUpdate

protected void saveOrUpdate(Object obj)
                     throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Either save() or update() the given instance, depending upon the value of its identifier property.

Throws:
net.sf.hibernate.HibernateException

saveOrUpdate

protected void saveOrUpdate(Object obj,
                            net.sf.hibernate.Session s)
                     throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Either save() or update() the given instance, depending upon the value of its identifier property.

Throws:
net.sf.hibernate.HibernateException

update

protected void update(Object obj)
               throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent instance with the same identifier in the current session.

Parameters:
obj - a transient instance containing updated state
Throws:
net.sf.hibernate.HibernateException

update

protected void update(Object obj,
                      net.sf.hibernate.Session s)
               throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent instance with the same identifier in the current session.

Parameters:
obj - a transient instance containing updated state
s - the Session
Throws:
net.sf.hibernate.HibernateException

delete

protected int delete(net.sf.hibernate.Query query)
              throws net.sf.hibernate.HibernateException
Delete all objects returned by the query

Throws:
net.sf.hibernate.HibernateException

delete

protected int delete(net.sf.hibernate.Query query,
                     net.sf.hibernate.Session s)
              throws net.sf.hibernate.HibernateException
Delete all objects returned by the query

Throws:
net.sf.hibernate.HibernateException

delete

protected void delete(Object obj)
               throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state.

Throws:
net.sf.hibernate.HibernateException

delete

protected void delete(Object obj,
                      net.sf.hibernate.Session s)
               throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state.

Throws:
net.sf.hibernate.HibernateException

refresh

protected void refresh(Object obj,
                       net.sf.hibernate.Session s)
                throws net.sf.hibernate.HibernateException
Used by the base DAO classes but here for your modification Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.

Throws:
net.sf.hibernate.HibernateException


Copyright 2007 Institut fuer Angewandte Informationsverarbeitung und Kommunikationstechnologie. All Rights Reserved.