Example usage for org.apache.ibatis.reflection.factory DefaultObjectFactory DefaultObjectFactory

List of usage examples for org.apache.ibatis.reflection.factory DefaultObjectFactory DefaultObjectFactory

Introduction

In this page you can find the example usage for org.apache.ibatis.reflection.factory DefaultObjectFactory DefaultObjectFactory.

Prototype

DefaultObjectFactory

Source Link

Usage

From source file:jp.co.ctc_g.jfw.core.jdbc.mybatis.QueryInformation.java

License:Apache License

/**
 * ??/*from  ww w.  ja  va 2  s  . com*/
 * MyBatis?{@link StatementHandler}???????{@link InternalException}???
 * @param statementHandler {@link StatementHandler}
 */
public QueryInformation(StatementHandler statementHandler) {
    try {
        this.typeHandlerRegistry = new TypeHandlerRegistry();
        this.statementHandler = getConcreteStatementHandler(statementHandler);
        this.mappedStatement = getMappedStatement(this.statementHandler);
        this.boundSql = this.statementHandler.getBoundSql();
        this.parameterObject = this.boundSql.getParameterObject();
        this.parameterMappingList = boundSql.getParameterMappings();
        this.sqlCommandType = mappedStatement.getSqlCommandType();
        this.statementType = mappedStatement.getStatementType();
        this.metaObject = parameterObject == null ? null
                : MetaObject.forObject(parameterObject, new DefaultObjectFactory(),
                        new DefaultObjectWrapperFactory());

        switch (statementType) {
        case STATEMENT:
            this.query = boundSql.getSql();
            break;
        case PREPARED:
            this.preparedQuery = boundSql.getSql();
            break;
        case CALLABLE:
            this.callableQuery = boundSql.getSql();
            break;
        default:
            throw new InternalException(QueryInformation.class, "");
        }
    } catch (Exception e) {
        throw new InternalException(QueryInformation.class, "E-JDBC-MYBATIS#0002", e);
    }
}