|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sqlproc.engine.impl.SqlMappingResult
public class SqlMappingResult
Holds the results of an explicit and an implicit mapping rules merging.
In the case of explicit mapping rule the grammar itself is defined in SqlMapping.g. In the case of implicit mapping
rule the grammar itself is defined in SqlStatement.g. The internal mapping rule is a dynamic one, and it's finalized
in the process of the final ANSI SQL query generation.
For the purpose of correct left join handling, the identities are identified. They are used to prevent the repeated
rows in the output result set. This is used for the associations (one-to-one, one-to-many and many-to-many).
The main runtime contracts are setQueryResultMapping(Class, Map, SqlQuery)
and
setQueryResultData(Object, Object[], Map, boolean[], Map)
.
Field Summary | |
---|---|
(package private) Map<String,SqlMappingIdentity> |
identities
The collection of identities related to all output columns. |
(package private) List<Integer> |
identitiesIndexes
The list of identities indexes in the list of output values. |
(package private) org.slf4j.Logger |
logger
The internal slf4j logger. |
(package private) Integer |
mainIdentityIndex
The main identity index in the list of output values. |
private Map<String,SqlMappingItem> |
mappings
All sub-elements based on ANTLR grammar defined in SqlMapping.g or SqlStatement.g. |
Constructor Summary | |
---|---|
SqlMappingResult(SqlMappingRule mapping,
Map<String,SqlMappingItem> outputMappings)
Creates a new instance. |
Method Summary | |
---|---|
(package private) void |
addMapping(SqlMappingItem item)
Adds a new mapping rule item in the merging process. |
(package private) void |
calculateIdentities()
Calculates all identities related information. |
Integer |
getMainIdentityIndex()
Returns the main identity index in the list of output values. |
private void |
merge(SqlMappingRule mapping,
Map<String,SqlMappingItem> outputMappings)
Merge mapping rule for one META SQL query based on SqlMapping.g and SqlStatement.g. |
void |
setQueryResultData(Object resultInstance,
Object[] resultValues,
Map<String,Object> instances,
boolean[] changedIdentities,
Map<String,Class<?>> moreResultClasses)
Fills the instance of the result class with output values from the SQL query execution. |
void |
setQueryResultMapping(Class<?> resultClass,
Map<String,Class<?>> moreResultClasses,
SqlQuery query)
Declares a scalar query results for all mapping rule items. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final org.slf4j.Logger logger
private Map<String,SqlMappingItem> mappings
Map<String,SqlMappingIdentity> identities
List<Integer> identitiesIndexes
Integer mainIdentityIndex
Constructor Detail |
---|
SqlMappingResult(SqlMappingRule mapping, Map<String,SqlMappingItem> outputMappings)
mapping
- mapping rule based on SqlMapping.g or the empty oneoutputMappings
- mapping rule items based on SqlStatement.gMethod Detail |
---|
public Integer getMainIdentityIndex()
void addMapping(SqlMappingItem item)
item
- a new mapping rule itemvoid calculateIdentities()
public void setQueryResultMapping(Class<?> resultClass, Map<String,Class<?>> moreResultClasses, SqlQuery query) throws SqlRuntimeException
resultClass
- the class used for the return valuesmoreResultClasses
- more result classes used for the return values, like the collections classes or the collections itemsquery
- the SQL Engine query, an adapter or proxy to the internal JDBC or ORM staff
SqlRuntimeException
- in the case of any problem with output values preparationpublic void setQueryResultData(Object resultInstance, Object[] resultValues, Map<String,Object> instances, boolean[] changedIdentities, Map<String,Class<?>> moreResultClasses) throws SqlRuntimeException
resultInstance
- the instance of the result classresultValues
- the query execution output valuesinstances
- the already allocated instances for the case of one-to-many or many-to-many repeated rowschangedIdentities
- the indicators of changed identities for the case of one-to-many or many-to-many repeated rowsmoreResultClasses
- more result classes used for the return values, like the collections classes or the collections items
SqlRuntimeException
- in the case of any problem with output values handlingprivate void merge(SqlMappingRule mapping, Map<String,SqlMappingItem> outputMappings)
mapping
- mapping rule based on SqlMapping.g or the empty oneoutputMappings
- mapping rule items based on SqlStatement.g
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |