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
- implements Query
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.3 2002/10/05 15:50:58 brj Exp $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_exampleObjectOrIdentity
private java.lang.Object m_exampleObjectOrIdentity
QueryByIdentity
public QueryByIdentity(java.lang.Object example_or_identity)
- QueryByIdentity can be generated from example Objects or by Identity Objects
getCriteria
public Criteria getCriteria()
- no Criteria available
- Specified by:
getCriteria in interface Query
getExampleObject
public java.lang.Object getExampleObject()
- Answer the example Object
- Specified by:
getExampleObject in interface Query
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
isDistinct
public boolean isDistinct()
- Description copied from interface:
Query
- return true if select DISTINCT should be used
- Specified by:
isDistinct in interface Query