Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ojb.broker.query
Class QueryByIdentity  view QueryByIdentity download QueryByIdentity.java

java.lang.Object
  extended byorg.apache.ojb.broker.query.AbstractQueryImpl
      extended byorg.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 $

Field Summary
private  java.lang.Object m_exampleObjectOrIdentity
           
 
Fields inherited from class org.apache.ojb.broker.query.AbstractQueryImpl
 
Fields inherited from interface org.apache.ojb.broker.query.Query
NO_END_AT_INDEX, NO_START_AT_INDEX, NOT_SCROLLABLE, SCROLLABLE
 
Constructor Summary
QueryByIdentity(java.lang.Object example_or_identity)
          QueryByIdentity can be generated from example Objects or by Identity Objects
 
Method Summary
 Criteria getCriteria()
          no Criteria available
 java.lang.Object getExampleObject()
          Answer the example Object
 java.lang.Class getSearchClass()
          Answer the search class.
 boolean isDistinct()
          return true if select DISTINCT should be used
 
Methods inherited from class org.apache.ojb.broker.query.AbstractQueryImpl
fullSize, fullSize, getEndAtIndex, getStartAtIndex, setEndAtIndex, setStartAtIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ojb.broker.query.Query
fullSize, fullSize, getEndAtIndex, getStartAtIndex, setEndAtIndex, setStartAtIndex
 

Field Detail

m_exampleObjectOrIdentity

private java.lang.Object m_exampleObjectOrIdentity
Constructor Detail

QueryByIdentity

public QueryByIdentity(java.lang.Object example_or_identity)
QueryByIdentity can be generated from example Objects or by Identity Objects

Method Detail

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