org.norther.tammi.root.ojb.query
Class OJBQuery<T>

java.lang.Object
  extended by org.norther.tammi.root.db.query.DBQueryAdapter<T,Query>
      extended by org.norther.tammi.root.ojb.query.OJBQuery<T>
Type Parameters:
T - the query type.
All Implemented Interfaces:
Serializable, DBQuery<T>

public class OJBQuery<T>
extends DBQueryAdapter<T,Query>
implements Serializable

An OJB query adapter.

Version:
$Id: OJBQuery.java,v 1.14 2010-06-30 15:42:06 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.root.db.query.DBQueryAdapter
factory
 
Constructor Summary
OJBQuery(String alias, Query query, MBeanReference<? extends PersisterFactory> pbf)
          Constructs a new query with an adaptee.
 
Method Summary
 int getLimit()
          Gets the number of rows to query.
 int getOffset()
          Gets the first row to query.
 Class<?> getPersistentClass()
          Gets the persistent class of the query.
 DBQuery<T> orderBy(String attribute, boolean desc)
          Orders the query.
 DBQuery<T> setLimit(int count)
          Sets the number of rows to query.
 DBQuery<T> setOffset(int offset)
          Sets the first row to query.
 DBQuery<T> setParameter(String name, Object value)
          Sets a query parameter.
 DBQuery<T> setParameters(Map<String,?> params)
          Sets the parameters of the query.
 
Methods inherited from class org.norther.tammi.root.db.query.DBQueryAdapter
getConnectionAlias, getPersisterFactory, getQuery, setQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OJBQuery

public OJBQuery(String alias,
                Query query,
                MBeanReference<? extends PersisterFactory> pbf)
Constructs a new query with an adaptee.

Parameters:
alias - the connection alias.
query - the query adaptee.
pbf - the persister factory.
Throws:
NullPointerException - for nulls.
Method Detail

getPersistentClass

public Class<?> getPersistentClass()
Description copied from interface: DBQuery
Gets the persistent class of the query.

Specified by:
getPersistentClass in interface DBQuery<T>
Returns:
the class type.

getOffset

public int getOffset()
Description copied from interface: DBQuery
Gets the first row to query.

Specified by:
getOffset in interface DBQuery<T>
Returns:
the row index.

setOffset

public DBQuery<T> setOffset(int offset)
Description copied from interface: DBQuery
Sets the first row to query.

Specified by:
setOffset in interface DBQuery<T>
Parameters:
offset - the row index.
Returns:
the modified query.

getLimit

public int getLimit()
Description copied from interface: DBQuery
Gets the number of rows to query.

Specified by:
getLimit in interface DBQuery<T>
Returns:
the row count (-1 = all).

setLimit

public DBQuery<T> setLimit(int count)
Description copied from interface: DBQuery
Sets the number of rows to query.

Specified by:
setLimit in interface DBQuery<T>
Parameters:
count - the row count (-1 = all).
Returns:
the modified query.

setParameter

public DBQuery<T> setParameter(String name,
                               Object value)
Description copied from interface: DBQuery
Sets a query parameter.

Specified by:
setParameter in interface DBQuery<T>
Parameters:
name - the parameter name.
value - the parameter value.
Returns:
the modified query.

setParameters

public DBQuery<T> setParameters(Map<String,?> params)
Description copied from interface: DBQuery
Sets the parameters of the query.

Specified by:
setParameters in interface DBQuery<T>
Parameters:
params - a map of parameters.
Returns:
the modified query.

orderBy

public DBQuery<T> orderBy(String attribute,
                          boolean desc)
Description copied from interface: DBQuery
Orders the query.

Specified by:
orderBy in interface DBQuery<T>
Parameters:
attribute - the sort attribute.
desc - true for descending.
Returns:
the modified query.


Copyright © 2004 The Norther Organization. All rights reserved.