toolbox.dao.orm
Interface ORMQueryService

Package class diagram package ORMQueryService
All Known Implementing Classes:
ORMQueryServiceImpl

public interface ORMQueryService

Interface that defines a generic service to perform SQL queries to resolve relationships between database entities.

Implementations of this interface are responsible for abstracting the underlying JDBC and SQL requirements.


Method Summary
 java.util.List getReferenceIds(java.lang.String mapping)
          Return a List of Strings that contain the names of the reference columns for the given mapping.
 java.util.List resolve(java.lang.String mapping)
          Resolve the relationships of the named mapping.
 java.util.List resolve(java.lang.String mapping, java.util.Map params)
          Resolve the relationships of the named mapping and narrow the results using the provided query parameters.
 java.lang.Object resolve(java.lang.String mapping, java.lang.Object key)
          Resolve the relationships of a single database entity using a primary key value.
 java.util.List resolve(java.lang.String mapping, PreparedQuery query, java.lang.String postfix)
          Resolve the relationships of the named mapping and narrow the results using the provided PreparedQuery instance.
 void setReferences(java.lang.String mapping, java.lang.Object instance)
          Set all the relationships for the given entity instance, given that the reference identifiers are available on the entity.
 void setReferences(java.lang.String mapping, java.lang.Object instance, java.lang.Object[] refIds)
          Set all the relationships for the given entity instance.
 

Method Detail

resolve

java.util.List resolve(java.lang.String mapping)
                       throws DaoException
Resolve the relationships of the named mapping.

Parameters:
mapping - String containing the name of the relational mapping.
Returns:
List of Objects where each instance represents a database entity with all relationships resolved.
Throws:
DaoException - if the mapping cannot be resolved.

resolve

java.util.List resolve(java.lang.String mapping,
                       java.util.Map params)
                       throws DaoException
Resolve the relationships of the named mapping and narrow the results using the provided query parameters.

Parameters:
mapping - String containing the name of the relational mapping.
params - Map instance containing query parameters.
Returns:
List of Objects where each instance represents a database entity with all relationships resolved.
Throws:
DaoException - if the mapping cannot be resolved.

resolve

java.util.List resolve(java.lang.String mapping,
                       PreparedQuery query,
                       java.lang.String postfix)
                       throws DaoException
Resolve the relationships of the named mapping and narrow the results using the provided PreparedQuery instance.

Parameters:
mapping - String containing the name of the relational mapping.
query - PreparedQuery instance containing query parameters.
postfix - An optional postfix to append to the query.
Returns:
List of Objects where each instance represents a database entity with all relationships resolved.
Throws:
DaoException - if the mapping cannot be resolved.

resolve

java.lang.Object resolve(java.lang.String mapping,
                         java.lang.Object key)
                         throws DaoException
Resolve the relationships of a single database entity using a primary key value.

Parameters:
mapping - String containing the name of the relational mapping.
key - Object instance containing the primary key of the entity to resolve.
Returns:
Object containing the database entity with all relationships resolved.
Throws:
DaoException - if the mapping cannot be resolved.

setReferences

void setReferences(java.lang.String mapping,
                   java.lang.Object instance,
                   java.lang.Object[] refIds)
                   throws DaoException
Set all the relationships for the given entity instance.

Parameters:
mapping - String containing the name of the relational mapping.
instance - Object instance that represents an entity with none of it's relationships resolved.
refIds - Object array containing the identifiers of the entities that are referenced by the entity instance.
Throws:
DaoException - if the relationships cannot resolved and applied to the given entity instance.

setReferences

void setReferences(java.lang.String mapping,
                   java.lang.Object instance)
                   throws DaoException
Set all the relationships for the given entity instance, given that the reference identifiers are available on the entity.

Parameters:
mapping - String containing the name of the relational mapping.
instance - Object instance that represents an entity with none of it's relationships resolved.
Throws:
DaoException - if the relationships cannot resolved and applied to the given entity instance.

getReferenceIds

java.util.List getReferenceIds(java.lang.String mapping)
Return a List of Strings that contain the names of the reference columns for the given mapping.

Parameters:
mapping - String containing the name of the relational mapping.
Returns:
List containing the reference column names for the given mapping.