org.apache.ojb.broker.query
Class QueryByIdentity
java.lang.Object
org.apache.ojb.broker.query.AbstractQueryImpl
org.apache.ojb.broker.query.QueryByIdentity
- All Implemented Interfaces:
- Query, java.io.Serializable
- public class QueryByIdentity
- extends AbstractQueryImpl
represents a search by identity.
"find the article with id 7"
could be represented as:
Article example = new Article();
example.setId(7);
Query qry = new QueryByIdentity(example);
The PersistenceBroker can retrieve Objects by examples as follows:
PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker();
Collection col = broker.getObjectByQuery(qry);
This Class can also handle working with OJB Identity objects:
"find the article with Identity xyz" could be represnted as
Identity xyz = new Identity(example);
Query qry = new QueryByIdentity(xyz);
- Version:
- $Id: QueryByIdentity.java,v 1.7 2003/06/12 16:49:16 arminw Exp $
- Author:
- Thomas Mahler
- See Also:
- Serialized Form
Constructor Summary |
QueryByIdentity(java.lang.Object example_or_identity)
QueryByIdentity can be generated from example Objects or by Identity Objects |
Methods inherited from class org.apache.ojb.broker.query.AbstractQueryImpl |
fullSize, fullSize, getBaseClass, getCriteria, getEndAtIndex, getGroupBy, getHavingCriteria, getOrderBy, getPrefetchedRelationships, getStartAtIndex, getWithExtents, isDistinct, setEndAtIndex, setStartAtIndex, setWithExtents, usePaging |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QueryByIdentity
public QueryByIdentity(java.lang.Object example_or_identity)
- QueryByIdentity can be generated from example Objects or by Identity Objects
getExampleObject
public java.lang.Object getExampleObject()
- Answer the example Object
- Specified by:
getExampleObject
in interface Query
- Overrides:
getExampleObject
in class AbstractQueryImpl
- Returns:
- the example Object or an Identity
getSearchClass
public java.lang.Class getSearchClass()
- Answer the search class.
This is the class of the example object or
the class represented by Identity.
- Specified by:
getSearchClass
in interface Query
- Overrides:
getSearchClass
in class AbstractQueryImpl
- Returns:
- Class
Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14