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 Commentable
EMPTY_COMMENTSFields inherited from interface MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERYFields inherited from interface 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[]////////////The class that defines this query, or null if none.intReturn the flush type for this query, or -1 if not set.String[]Query hints.Object[]Query hints.Return the query language.intReturn the line number of the file at which this instance was parsed.Return the lock mode name for this query, or null if not set.intReturn the max results for this query, or -1 if not set.getName()Return the name for this query.OrderedMap<Object, Class<?>> The already parsed form of this query, or null if none.The identifier of the parsed form of this query, or null if none.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./////////////////////////////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.voidsetFlushType(int flushType) Set the flush type for this query.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) voidsetLockMode(String lockMode) Set the lock mode name for this query.voidsetMaxResults(int maxResults) Set the max results for this query. -1 means not set.voidsetParamTypes(OrderedMap<Object, Class<?>> paramTypes) voidsetParsedQuery(Object parsed) The already parsed form of this query, or null if none.voidThe identifier of the parsed form of this query, or null if none.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. -
getParsedQuery
The already parsed form of this query, or null if none. Non string-based query languages such as the Criteria API are not necessarily expressible as a parseable query string, so their compiled form is held here and replayed verbatim instead of being re-parsed fromgetQueryString(). -
setParsedQuery
The already parsed form of this query, or null if none. -
getParsedQueryId
The identifier of the parsed form of this query, or null if none. A query of a non string-based language has no query string to be identified by, so the identifier is rendered once, when the query is registered: the parsed form is shared by every replay of the query and rendering it again would read the shared form without holding its lock. -
setParsedQueryId
The identifier of the parsed form of this query, or null if none. -
getHintKeys
Query hints. -
getHintValues
Query hints. -
addHint
-
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
-
getMaxResults
public int getMaxResults()Return the max results for this query, or -1 if not set. -
setMaxResults
public void setMaxResults(int maxResults) Set the max results for this query. -1 means not set. -
getFlushType
public int getFlushType()Return the flush type for this query, or -1 if not set. This is a FlushBeforeQueries constant from FetchConfiguration. -
setFlushType
public void setFlushType(int flushType) Set the flush type for this query. This is a FlushBeforeQueries constant from FetchConfiguration. -
getLockMode
Return the lock mode name for this query, or null if not set. -
setLockMode
Set the lock mode name for this query. -
getSourceMode
public int getSourceMode()The source mode of this query. -
setSourceMode
public void setSourceMode(int mode) The source mode of this query. -
toString
-
getComments
-
setComments
Description copied from interface:CommentableSet comments.- Specified by:
setCommentsin interfaceCommentable
-
getSourceFile
/////////////////////////////- 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.
-