edu.sdsc.inca.depot.persistent
Class DAO

java.lang.Object
  extended by edu.sdsc.inca.depot.persistent.DAO
Direct Known Subclasses:
ArgDAO, ArgSignatureDAO, ComparisonResultDAO, InstanceInfoDAO, ReportDAO, RunInfoDAO, SeriesConfigDAO, SeriesDAO, SuiteDAO

public abstract class DAO
extends java.lang.Object

This is the base class for the depot DAOs--classes that transfer objects between memory and the depot database. Since child DAO classes will each deal with a different DB class, this class doesn't define abstract methods for children to override. Instead, the set of methods that child classes should define is described in comments below. Which methods from this set a child class actually implements depends on which are needed; the description is intended to provide a convention to follow.

Author:
cmills, jhayes

Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
DAO()
           
 
Method Summary
static java.lang.Object save(java.lang.Object o)
          Stores an object that has not previously been saved in the database.
static java.util.List selectMultiple(java.lang.String query, java.lang.Object[] params)
          Return the set of objects selected by a Hibernate query.
static java.lang.Object selectUnique(java.lang.String query, java.lang.Object[] params)
          Return the unique object selected by a Hibernate query.
static java.lang.Object update(java.lang.Object o)
          Updates an object that has previously been saved in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger
Constructor Detail

DAO

public DAO()
Method Detail

selectUnique

public static java.lang.Object selectUnique(java.lang.String query,
                                            java.lang.Object[] params)
                                     throws PersistenceException
Return the unique object selected by a Hibernate query.

Parameters:
query - the Hibernate query; see Hibernate doc for format
params - a set of objects to plug into the query in spots marked as :p0, :p1, etc. May be null if the query has no params.
Returns:
the object selected by the query; null if none
Throws:
PersistenceException - on error

selectMultiple

public static java.util.List selectMultiple(java.lang.String query,
                                            java.lang.Object[] params)
                                     throws PersistenceException
Return the set of objects selected by a Hibernate query.

Parameters:
query - the Hibernate query; see Hibernate doc for format
params - a set of objects to plug into the query in spots marked as :p0, :p1, etc. May be null if the query has no params.
Returns:
the (possibly empty) set of objects selected by the query
Throws:
PersistenceException - on error

save

public static java.lang.Object save(java.lang.Object o)
                             throws PersistenceException
Stores an object that has not previously been saved in the database.

Parameters:
o - the object to store
Returns:
o, for convenience
Throws:
PersistenceException - on error

update

public static java.lang.Object update(java.lang.Object o)
                               throws PersistenceException
Updates an object that has previously been saved in the database.

Parameters:
o - the object to store
Returns:
o, for convenience
Throws:
PersistenceException - on error