Package org.apache.openjpa.meta
Class QueryMetaData
java.lang.Object
org.apache.openjpa.meta.QueryMetaData
- All Implemented Interfaces:
Serializable,SourceTracker,Commentable,MetaDataModes
- Direct Known Subclasses:
MultiQueryMetaData
public class QueryMetaData
extends Object
implements MetaDataModes, SourceTracker, Commentable, Serializable
Holds metadata about named queries.
Information stored in this instance gets transfered to
new
Query instances.- Author:
- Steve Kim
- See Also:
-
Field Summary
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTSFields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERYFields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedQueryMetaData(String name, boolean convertPositionalParametersToNamed) Construct with the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a query hint.The query candidate class, or null if none.intReturn the column number in the line of the file at which this instance was parsed.String[]Return comments, or empty array if none.The class that defines this query, or null if none.String[]Query hints.Object[]Query hints.Return the query language.intReturn the line number of the file at which this instance was parsed.getName()Return the name for this query.OrderedMap<Object,Class<?>> The full query string, or null if none.Return the domain-meaningful name of the resource that was loaded from this source.The query result class, or null if none.Return the file from which this instance was parsed.intThe source mode of this query.Return the domain-dependent scope of this instance within its file.intReturn the type of source.booleanWhether the query has been marked read-only.voidsetCandidateType(Class cls) The query result class, or null if none.voidsetColNumber(int colNum) voidsetComments(String[] comments) Set comments.voidsetDefiningType(Class cls) The class that defines this query, or null if none.voidInitialize this instance from the values held in the specifiedQuery.voidSet query template information into the given concrete query instance.voidsetLanguage(String language) Set the language for this query.voidsetLineNumber(int lineNum) voidsetParamTypes(OrderedMap<Object, Class<?>> paramTypes) voidsetQueryString(String query) The full query string, or null if none.voidsetReadOnly(boolean readOnly) Whether the query has been marked read-only.voidsetResultSetMappingName(String setMappingName) voidsetResultType(Class cls) The query result class, or null if none.voidvoidsetSourceMode(int mode) The source mode of this query.toString()
-
Constructor Details
-
QueryMetaData
Construct with the given name.
-
-
Method Details
-
getName
Return the name for this query. -
getDefiningType
The class that defines this query, or null if none. -
setDefiningType
The class that defines this query, or null if none. -
isReadOnly
public boolean isReadOnly()Whether the query has been marked read-only. -
setReadOnly
public void setReadOnly(boolean readOnly) Whether the query has been marked read-only. -
getCandidateType
The query candidate class, or null if none. -
setCandidateType
The query result class, or null if none. -
getResultType
The query result class, or null if none. -
setResultType
The query result class, or null if none. -
getLanguage
Return the query language. -
setLanguage
Set the language for this query. -
getQueryString
The full query string, or null if none. -
setQueryString
The full query string, or null if none. -
getHintKeys
Query hints. -
getHintValues
Query hints. -
addHint
Add a query hint. -
getResultSetMappingName
-
setResultSetMappingName
-
setInto
Set query template information into the given concrete query instance. However, the language, query string, and candidate class are assumed to be declared in the query instantiation, and hints are not transferred. -
setFrom
Initialize this instance from the values held in the specifiedQuery. -
getSourceMode
public int getSourceMode()The source mode of this query. -
setSourceMode
public void setSourceMode(int mode) The source mode of this query. -
toString
-
getComments
Description copied from interface:CommentableReturn comments, or empty array if none.- Specified by:
getCommentsin interfaceCommentable
-
setComments
Description copied from interface:CommentableSet comments.- Specified by:
setCommentsin interfaceCommentable
-
getSourceFile
Description copied from interface:SourceTrackerReturn the file from which this instance was parsed.- Specified by:
getSourceFilein interfaceSourceTracker
-
getSourceScope
Description copied from interface:SourceTrackerReturn the domain-dependent scope of this instance within its file.- Specified by:
getSourceScopein interfaceSourceTracker
-
getSourceType
public int getSourceType()Description copied from interface:SourceTrackerReturn the type of source.- Specified by:
getSourceTypein interfaceSourceTracker
-
setSource
-
getResourceName
Description copied from interface:SourceTrackerReturn the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.- Specified by:
getResourceNamein interfaceSourceTracker
-
getLineNumber
public int getLineNumber()Description copied from interface:SourceTrackerReturn the line number of the file at which this instance was parsed.- Specified by:
getLineNumberin interfaceSourceTracker
-
setLineNumber
public void setLineNumber(int lineNum) -
getColNumber
public int getColNumber()Description copied from interface:SourceTrackerReturn the column number in the line of the file at which this instance was parsed.- Specified by:
getColNumberin interfaceSourceTracker
-
setColNumber
public void setColNumber(int colNum) -
getSourceName
-
setParamTypes
-
getParamTypes
- Returns:
- a map of parameter name to type for this named query or null if this data hasn't been set.
-