Search in sources :

Example 1 with JdbcCallFunctionReturnImpl

use of org.hibernate.sql.exec.internal.JdbcCallFunctionReturnImpl in project hibernate-orm by hibernate.

the class FunctionReturnImpl method toJdbcFunctionReturn.

@Override
public JdbcCallFunctionReturn toJdbcFunctionReturn(SharedSessionContractImplementor persistenceContext) {
    final BindableType<T> ormType;
    final JdbcCallRefCursorExtractorImpl refCursorExtractor;
    final JdbcCallParameterExtractorImpl<T> parameterExtractor;
    if (getJdbcTypeCode() == Types.REF_CURSOR) {
        refCursorExtractor = new JdbcCallRefCursorExtractorImpl(null, 1);
        ormType = null;
        parameterExtractor = null;
    } else {
        final TypeConfiguration typeConfiguration = persistenceContext.getFactory().getTypeConfiguration();
        final JdbcType sqlTypeDescriptor = typeConfiguration.getJdbcTypeRegistry().getDescriptor(getJdbcTypeCode());
        final BasicJavaType<?> javaTypeMapping = sqlTypeDescriptor.getJdbcRecommendedJavaTypeMapping(null, null, typeConfiguration);
        // noinspection unchecked
        ormType = (BindableType<T>) typeConfiguration.standardBasicTypeForJavaType(javaTypeMapping.getJavaTypeClass());
        parameterExtractor = new JdbcCallParameterExtractorImpl<>(procedureCall.getProcedureName(), null, 1, ormType);
        refCursorExtractor = null;
    }
    return new JdbcCallFunctionReturnImpl(ormType, parameterExtractor, refCursorExtractor);
}
Also used : JdbcCallRefCursorExtractorImpl(org.hibernate.sql.exec.internal.JdbcCallRefCursorExtractorImpl) JdbcType(org.hibernate.type.descriptor.jdbc.JdbcType) JdbcCallFunctionReturnImpl(org.hibernate.sql.exec.internal.JdbcCallFunctionReturnImpl) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration)

Aggregations

JdbcCallFunctionReturnImpl (org.hibernate.sql.exec.internal.JdbcCallFunctionReturnImpl)1 JdbcCallRefCursorExtractorImpl (org.hibernate.sql.exec.internal.JdbcCallRefCursorExtractorImpl)1 JdbcType (org.hibernate.type.descriptor.jdbc.JdbcType)1 TypeConfiguration (org.hibernate.type.spi.TypeConfiguration)1