org.apache.cayenne.lifecycle.id
Class StringIdQuery

java.lang.Object
  extended by org.apache.cayenne.lifecycle.id.StringIdQuery
All Implemented Interfaces:
Serializable, ConfigurationNode, Query

public class StringIdQuery
extends Object
implements Query

A query that allows to fetch objects based on one or more String IDs. The returned objects do not have to be of the same type, be related via inheritance, or come from the same DB table. Note that if you expect multiple types of objects, use ObjectContext.performGenericQuery(Query). The returned QueryResponse will contain separate lists of DataRows for each type in no particular order.

As of this writing, a limitation of this query is that it returns DataRows that need to be manually converted to objects if needed. In that it is similar to QueryChain.

Since:
3.1
See Also:
Serialized Form

Field Summary
protected  DataMap dataMap
           
protected  Map<String,SelectQuery> idQueriesByEntity
           
protected  String name
           
protected  Collection<String> stringIds
           
 
Constructor Summary
StringIdQuery(Collection<String> stringIds)
           
StringIdQuery(String... stringIds)
           
 
Method Summary
<T> T
acceptVisitor(ConfigurationNodeVisitor<T> visitor)
           
 void addStringIds(String... ids)
           
 SQLAction createSQLAction(SQLActionVisitor visitor)
           
 DataMap getDataMap()
           
protected  Map<String,SelectQuery> getIdQueriesByEntity(EntityResolver resolver)
           
 QueryMetadata getMetaData(EntityResolver resolver)
           
 String getName()
           
 Collection<String> getStringIds()
           
 void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)
           
 void setDataMap(DataMap dataMap)
           
 void setName(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name

dataMap

protected DataMap dataMap

stringIds

protected Collection<String> stringIds

idQueriesByEntity

protected transient Map<String,SelectQuery> idQueriesByEntity
Constructor Detail

StringIdQuery

public StringIdQuery(String... stringIds)

StringIdQuery

public StringIdQuery(Collection<String> stringIds)
Method Detail

getStringIds

public Collection<String> getStringIds()

addStringIds

public void addStringIds(String... ids)

getIdQueriesByEntity

protected Map<String,SelectQuery> getIdQueriesByEntity(EntityResolver resolver)

acceptVisitor

public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
Specified by:
acceptVisitor in interface ConfigurationNode

getMetaData

public QueryMetadata getMetaData(EntityResolver resolver)
Specified by:
getMetaData in interface Query

route

public void route(QueryRouter router,
                  EntityResolver resolver,
                  Query substitutedQuery)
Specified by:
route in interface Query

createSQLAction

public SQLAction createSQLAction(SQLActionVisitor visitor)
Specified by:
createSQLAction in interface Query

getName

public String getName()
Specified by:
getName in interface Query

setName

public void setName(String name)

getDataMap

public DataMap getDataMap()
Specified by:
getDataMap in interface Query

setDataMap

public void setDataMap(DataMap dataMap)


Copyright © 2001-2013 Apache Cayenne. All Rights Reserved.