com.redstarhackers.dal
Interface DataAccessLayer

All Known Subinterfaces:
DataAccessStrategy

public interface DataAccessLayer

Data Access Layer API, used to access data stores in a generic way, deferring the implementation details to specific Data Access Strategies.

Version:
$Revision: 1115 $
Author:
$Author: kostya $

Method Summary
 void addModel(com.redstarhackers.model.Model model)
          Add the model to the data store.
 java.util.List executeNamedQuery(java.lang.String queryName, java.util.List parameters)
          Execute the named query using the parameters, returning the results (if any).
 java.util.List executeNamedQuery(java.lang.String queryName, java.util.List parameters, int firstResult, int maxResults)
          Execute the named query using the parameters, returning the results (if any).
 java.util.List executeNamedQuery(java.lang.String queryName, java.util.Map parameters)
          Execute the named query using the parameters, returning the results (if any).
 java.util.List executeNamedQuery(java.lang.String queryName, java.util.Map parameters, int firstResult, int maxResults)
          Execute the named query using the parameters, returning the results (if any).
 int executeNamedStatement(java.lang.String statementName, java.util.List parameters)
          Execute the statement using the parameters, returning the results (if any).
 int executeNamedStatement(java.lang.String statementName, java.util.Map parameters)
          Execute the statement using the parameters, returning the results (if any).
 java.util.List executeQuery(Query query, java.lang.Class resultClass)
          Execute the query using any contained expression (or chain of expressions) to qualify the query, returning the results (if any).
 java.util.List executeQuery(Query query, java.lang.Class resultClass, int firstResult, int maxResults)
          Execute the query using any contained expression (or chain of expressions) to qualify the query, returning the results (if any).
 java.util.List executeQuery(Query query, java.lang.Class resultClass, java.util.List parameters)
          Execute the query using the parameters, returning the results (if any) as instances of the model class.
 java.util.List executeQuery(Query query, java.lang.Class resultClass, java.util.List parameters, int firstResult, int maxResults)
          Execute the query using the parameters, returning the results (if any) as instances of the model class.
 java.util.List executeQuery(Query query, java.lang.Class resultClass, java.util.Map parameters)
          Execute the query using the parameters, returning the results (if any) as instances of the model class.
 java.util.List executeQuery(Query query, java.lang.Class resultClass, java.util.Map parameters, int firstResult, int maxResults)
          Execute the query using the parameters, returning the results (if any) as instances of the model class.
 int executeStatement(java.lang.String statement, java.util.List parameters)
          Execute the statement using the parameters, returning the results (if any).
 int executeStatement(java.lang.String statement, java.util.Map parameters)
          Execute the statement using the parameters, returning the results (if any).
 Query getNamedQuery(java.lang.String name)
          Retrieve the query mapped to the given name.
 java.lang.String getNamedStatement(java.lang.String name)
          Retrieve the statement mapped to the given name.
 com.redstarhackers.model.Model loadModel(java.lang.Class modelClass, java.io.Serializable identifier)
          Load an Model object through its unique identifier.
 void removeModel(java.lang.Class modelClass, java.io.Serializable identifier)
          Delete a given model of the specified class using the unique identifier.
 void removeModel(com.redstarhackers.model.Model model)
          Delete a given model from the data store.
 void updateModel(com.redstarhackers.model.Model model)
          Save the model in the data store, updating its persistent state.
 void updateModel(com.redstarhackers.model.Model model, java.io.Serializable identifier)
          Save the model in the data store, updating its persistent state.
 

Method Detail

loadModel

public com.redstarhackers.model.Model loadModel(java.lang.Class modelClass,
                                                java.io.Serializable identifier)
Load an Model object through its unique identifier.

Parameters:
modelClass - class to load for
identifier - unique identifier
Returns:
matching object or null if not found

addModel

public void addModel(com.redstarhackers.model.Model model)
Add the model to the data store. This method will populate any "auto-generated" ids directly into the model reference.

Parameters:
model - the model to add

updateModel

public void updateModel(com.redstarhackers.model.Model model)
Save the model in the data store, updating its persistent state.

Parameters:
model - the data to update with

updateModel

public void updateModel(com.redstarhackers.model.Model model,
                        java.io.Serializable identifier)
Save the model in the data store, updating its persistent state.

Parameters:
model - the data to update with
identifier - unique identifier

removeModel

public void removeModel(com.redstarhackers.model.Model model)
Delete a given model from the data store.

Parameters:
model - the model to remove

removeModel

public void removeModel(java.lang.Class modelClass,
                        java.io.Serializable identifier)
Delete a given model of the specified class using the unique identifier.

Parameters:
modelClass - class to load for
identifier - unique identifier

getNamedQuery

public Query getNamedQuery(java.lang.String name)
Retrieve the query mapped to the given name.

Parameters:
name - the name to retrieve the query for.
Returns:
the Query for the name.

executeNamedQuery

public java.util.List executeNamedQuery(java.lang.String queryName,
                                        java.util.Map parameters)
Execute the named query using the parameters, returning the results (if any).

Parameters:
queryName - the name of the query
parameters - the parameters (name => value)
Returns:
the results of the query, if any

executeNamedQuery

public java.util.List executeNamedQuery(java.lang.String queryName,
                                        java.util.Map parameters,
                                        int firstResult,
                                        int maxResults)
Execute the named query using the parameters, returning the results (if any).

Parameters:
queryName - the name of the query
parameters - the parameters (name => value)
firstResult - first row in the result set to start at
maxResults - max number of rows to return (0 means all)
Returns:
the results of the query, if any

executeNamedQuery

public java.util.List executeNamedQuery(java.lang.String queryName,
                                        java.util.List parameters)
Execute the named query using the parameters, returning the results (if any).

Parameters:
queryName - the name of the query
parameters - the parameters (positional)
Returns:
the results of the query, if any

executeNamedQuery

public java.util.List executeNamedQuery(java.lang.String queryName,
                                        java.util.List parameters,
                                        int firstResult,
                                        int maxResults)
Execute the named query using the parameters, returning the results (if any).

Parameters:
queryName - the name of the query
parameters - the parameters (positional)
firstResult - first row in the result set to start at
maxResults - max number of rows to return (0 means all)
Returns:
the results of the query, if any

executeQuery

public java.util.List executeQuery(Query query,
                                   java.lang.Class resultClass,
                                   java.util.Map parameters)
Execute the query using the parameters, returning the results (if any) as instances of the model class.

Parameters:
query - the query
resultClass - the class to use for the resulting rows
parameters - the parameters (name => value)
Returns:
the results of the query, if any

executeQuery

public java.util.List executeQuery(Query query,
                                   java.lang.Class resultClass,
                                   java.util.Map parameters,
                                   int firstResult,
                                   int maxResults)
Execute the query using the parameters, returning the results (if any) as instances of the model class.

Parameters:
query - the query
resultClass - the class to use for the resulting rows
parameters - the parameters (name => value)
firstResult - first row in the result set to start at
maxResults - max number of rows to return (0 means all)
Returns:
the results of the query, if any

executeQuery

public java.util.List executeQuery(Query query,
                                   java.lang.Class resultClass,
                                   java.util.List parameters)
Execute the query using the parameters, returning the results (if any) as instances of the model class.

Parameters:
query - the query
resultClass - the class to use for the resulting rows
parameters - the parameters (positional)
Returns:
the results of the query, if any

executeQuery

public java.util.List executeQuery(Query query,
                                   java.lang.Class resultClass,
                                   java.util.List parameters,
                                   int firstResult,
                                   int maxResults)
Execute the query using the parameters, returning the results (if any) as instances of the model class.

Parameters:
query - the query
resultClass - the class to use for the resulting rows
parameters - the parameters (positional)
firstResult - first row in the result set to start at
maxResults - max number of rows to return (0 means all)
Returns:
the results of the query, if any

executeQuery

public java.util.List executeQuery(Query query,
                                   java.lang.Class resultClass)
Execute the query using any contained expression (or chain of expressions) to qualify the query, returning the results (if any).

Parameters:
query - the query
resultClass - the class to use for the resulting rows
Returns:
the results of the query, if any

executeQuery

public java.util.List executeQuery(Query query,
                                   java.lang.Class resultClass,
                                   int firstResult,
                                   int maxResults)
Execute the query using any contained expression (or chain of expressions) to qualify the query, returning the results (if any).

Parameters:
query - the query
resultClass - the class to use for the resulting rows
firstResult - first row in the result set to start at
maxResults - max number of rows to return (0 means all)
Returns:
the results of the query, if any

getNamedStatement

public java.lang.String getNamedStatement(java.lang.String name)
Retrieve the statement mapped to the given name.

Parameters:
name - the name to retrieve the query for.
Returns:
the statement String for the name.

executeNamedStatement

public int executeNamedStatement(java.lang.String statementName,
                                 java.util.Map parameters)
Execute the statement using the parameters, returning the results (if any).

Parameters:
statementName - the name of the statement
parameters - the parameters (name => value)
Returns:
the results of the query, if any

executeNamedStatement

public int executeNamedStatement(java.lang.String statementName,
                                 java.util.List parameters)
Execute the statement using the parameters, returning the results (if any).

Parameters:
statementName - the name of the statement
parameters - the parameters (positional)
Returns:
the results of the query, if any

executeStatement

public int executeStatement(java.lang.String statement,
                            java.util.Map parameters)
Execute the statement using the parameters, returning the results (if any).

Parameters:
statement - the statement SQL
parameters - the parameters (name => value)
Returns:
the results of the query, if any

executeStatement

public int executeStatement(java.lang.String statement,
                            java.util.List parameters)
Execute the statement using the parameters, returning the results (if any).

Parameters:
statement - the statement SQL
parameters - the parameters (positional)
Returns:
the results of the query, if any