org.sqlproc.engine.impl
Class SqlMappingItem

java.lang.Object
  extended by org.sqlproc.engine.impl.SqlMappingItem

 class SqlMappingItem
extends java.lang.Object

The Mapping rule entity for one output attribute. Instance of this class is created by the ANTLR parser. The grammar itself is defined in SqlMapping.g.

Author:
Vladimir Hudec

Field Summary
private  java.lang.String dbName
          The name of a database query output - the column name or the alias name.
private  java.util.List<java.lang.String> javaNames
          The name of an attribute in the result class.
(package private)  org.slf4j.Logger logger
          The internal slf4j logger.
private  SqlType sqlType
          The type of an attribute in the result class and/or the database column type.
 
Constructor Summary
SqlMappingItem(java.lang.String dbName)
          Creates a new instance.
 
Method Summary
(package private)  void addName(java.lang.String name)
          Adds a partial name of an attribute.
(package private)  void setHibernateType(java.lang.String sHibernateType)
          Assigns a Hibernate type.
(package private)  void setMetaType(java.lang.String sMetaType)
          Assigns an internal type.
(package private)  void setQueryResultData(java.lang.Object resultInstance, java.lang.Object resultValue)
          Initializes the attribute of the result class with output values from SQL query execution.
 void setQueryResultMapping(java.lang.Class<?> resultClass, org.hibernate.SQLQuery query)
          Declares a scalar query result for this mapping rule item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

final org.slf4j.Logger logger
The internal slf4j logger.


javaNames

private java.util.List<java.lang.String> javaNames
The name of an attribute in the result class. In the case of embedded classes the can be in fact a list of partial names (name1.name2...nameX). This name can be null. In this case the name of the attribute is the same as the name of the query column or alias output.


dbName

private java.lang.String dbName
The name of a database query output - the column name or the alias name.


sqlType

private SqlType sqlType
The type of an attribute in the result class and/or the database column type. In fact it's a pair of a Hibernate type and/or an internal type.

Constructor Detail

SqlMappingItem

SqlMappingItem(java.lang.String dbName)
Creates a new instance. It's used from inside ANTLR parser.

Parameters:
dbName - the name of a database query output - the column name or the alias name
Method Detail

addName

void addName(java.lang.String name)
Adds a partial name of an attribute.

Parameters:
name - the partial name of an attribute in the result class

setMetaType

void setMetaType(java.lang.String sMetaType)
Assigns an internal type. This type it's used in a conversion process of SQL query output values.

Parameters:
sMetaType - String representation of an internal type for this mapping rule item

setHibernateType

void setHibernateType(java.lang.String sHibernateType)
Assigns a Hibernate type. This type it's used in a conversion process of SQL query output values.

Parameters:
sHibernateType - String representation of an Hibernate type for this mapping rule item

setQueryResultMapping

public void setQueryResultMapping(java.lang.Class<?> resultClass,
                                  org.hibernate.SQLQuery query)
Declares a scalar query result for this mapping rule item.

Parameters:
resultClass - the class used for the return values, the SQL execution output
query - Hibernate SQL Query instance

setQueryResultData

void setQueryResultData(java.lang.Object resultInstance,
                        java.lang.Object resultValue)
Initializes the attribute of the result class with output values from SQL query execution.

Parameters:
resultInstance - the instance of the result class
resultValue - query execution output value


Copyright © 2010. All Rights Reserved.