ojb.broker.query
Class QueryByExample

java.lang.Object
  |
  +--ojb.broker.query.QueryByExample
All Implemented Interfaces:
Query, java.io.Serializable

public class QueryByExample
extends java.lang.Object
implements Query

represents a search by example. "find the article with id 7" could be represented as: Article example = new Article(); example.setId(7); Query qry = new QueryByExample(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 QueryByExample(xyz);

See Also:
Serialized Form

Constructor Summary
QueryByExample(java.lang.Object example_or_identity)
          QueryByExample can be generated from example Objects or by Identity Objects
 
Method Summary
 Criteria getCriteria()
          Method declaration
 java.lang.Object getExampleObject()
          Method declaration
 java.lang.Class getSearchClass()
          Method declaration
 boolean isDistinct()
          return true if select DISTINCT should be used
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryByExample

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

Method Detail

getCriteria

public Criteria getCriteria()
Method declaration

Specified by:
getCriteria in interface Query
Returns:

getExampleObject

public java.lang.Object getExampleObject()
Method declaration

Specified by:
getExampleObject in interface Query
Returns:

getSearchClass

public java.lang.Class getSearchClass()
Method declaration

Specified by:
getSearchClass in interface Query
Returns:

isDistinct

public boolean isDistinct()
Description copied from interface: Query
return true if select DISTINCT should be used

Specified by:
isDistinct in interface Query


Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04