to.etc.webapp.query
Interface IQueryExecutor<C extends QDataContext>

All Known Implementing Classes:
HibernateQueryExecutor, JdbcQueryExecutor

public interface IQueryExecutor<C extends QDataContext>


Method Summary
 void attach(C root, java.lang.Object o)
           
 void delete(C root, java.lang.Object o)
          EXPERIMENTAL/NOT FINAL Cause the object to be deleted from the database.
<T> T
find(C root, java.lang.Class<T> clz, java.lang.Object pk)
          Load the persistent object with the specified type and primary key from the database.
<T> T
find(C root, ICriteriaTableDef<T> metatable, java.lang.Object pk)
           
<T> T
getInstance(C root, java.lang.Class<T> clz, java.lang.Object pk)
          Load the persistent object with the specified type and primary key from the database.
<T> T
getInstance(C root, ICriteriaTableDef<T> clz, java.lang.Object pk)
           
<T> java.util.List<T>
query(C root, QCriteria<T> q)
          Execute the query specified by q and return a list of results.
 java.util.List<java.lang.Object[]> query(C root, QSelection<?> sel)
          Issue a selection query, where multiple fields or projections on fields are selected from a base class.
 void refresh(C root, java.lang.Object o)
          EXPERIMENTAL/NOT FINAL Refresh with latest content in the database.
 void save(C root, java.lang.Object o)
          EXPERIMENTAL/NOT FINAL Cause the object to be inserted in the database.
 

Method Detail

query

<T> java.util.List<T> query(C root,
                            QCriteria<T> q)
                        throws java.lang.Exception
Execute the query specified by q and return a list of results. Before and after the query execution all registered listeners will be called.

Type Parameters:
T - The return type for this query, a persistent class type
Parameters:
q - The selection criteria
Returns:
Throws:
java.lang.Exception

query

java.util.List<java.lang.Object[]> query(C root,
                                         QSelection<?> sel)
                                         throws java.lang.Exception
Issue a selection query, where multiple fields or projections on fields are selected from a base class.

Parameters:
sel -
Returns:
Throws:
java.lang.Exception

find

<T> T find(C root,
           java.lang.Class<T> clz,
           java.lang.Object pk)
       throws java.lang.Exception
Load the persistent object with the specified type and primary key from the database. This will execute an actual select in the database if the object is not yet cached, ensuring that the object actually exists. If the object does not exist this will return null.

Type Parameters:
T - The object type.
Parameters:
clz - The persistent class for which an instance is being sought.
pk - The PK for the instance required.
Returns:
Null if the instance does not exist, the actual and fully initialized instance (or proxy) otherwise.
Throws:
java.lang.Exception

find

<T> T find(C root,
           ICriteriaTableDef<T> metatable,
           java.lang.Object pk)
       throws java.lang.Exception
Throws:
java.lang.Exception

getInstance

<T> T getInstance(C root,
                  java.lang.Class<T> clz,
                  java.lang.Object pk)
              throws java.lang.Exception
Load the persistent object with the specified type and primary key from the database. This will return an object always even if the object does not exist in the database! This should only be used when you need an instance representing a given primary key that you know exists. This usually returns a proxy, meaning that nonexistent objects will throw exceptions as soon as properties other than it's primary key are accessed. To get an object and be sure it is present in the database use QDataContext.find(Class, Object).

Type Parameters:
T - The object type
Parameters:
clz - The persistent class for which an instance is being sought.
pk - The PK for the instance required.
Returns:
Always returns an instance; it can be invalid when it does not really exist on the backing store.
Throws:
java.lang.Exception

getInstance

<T> T getInstance(C root,
                  ICriteriaTableDef<T> clz,
                  java.lang.Object pk)
              throws java.lang.Exception
Throws:
java.lang.Exception

save

void save(C root,
          java.lang.Object o)
          throws java.lang.Exception
EXPERIMENTAL/NOT FINAL Cause the object to be inserted in the database.

Parameters:
o -
Throws:
java.lang.Exception

refresh

void refresh(C root,
             java.lang.Object o)
             throws java.lang.Exception
EXPERIMENTAL/NOT FINAL Refresh with latest content in the database.

Parameters:
o -
Throws:
java.lang.Exception

delete

void delete(C root,
            java.lang.Object o)
            throws java.lang.Exception
EXPERIMENTAL/NOT FINAL Cause the object to be deleted from the database.

Parameters:
o -
Throws:
java.lang.Exception

attach

void attach(C root,
            java.lang.Object o)
            throws java.lang.Exception
Throws:
java.lang.Exception