Search in sources :

Example 1 with JdbcCallParameterRegistrationImpl

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

the class ProcedureParameterImpl method toJdbcParameterRegistration.

@Override
public JdbcCallParameterRegistration toJdbcParameterRegistration(int startIndex, ProcedureCallImplementor<?> procedureCall) {
    final QueryParameterBinding<T> binding = procedureCall.getParameterBindings().getBinding(this);
    final BindableType<T> typeToUse = BindingTypeHelper.INSTANCE.resolveTemporalPrecision(binding == null || binding.getExplicitTemporalPrecision() == null ? null : binding.getExplicitTemporalPrecision(), getHibernateType(), procedureCall.getSession().getFactory());
    final String name;
    if (procedureCall.getParameterStrategy() == ParameterStrategy.NAMED && canDoNameParameterBinding(typeToUse, procedureCall)) {
        name = this.name;
    } else {
        name = null;
    }
    final JdbcParameterBinder parameterBinder;
    final JdbcCallRefCursorExtractorImpl refCursorExtractor;
    final JdbcCallParameterExtractorImpl<T> parameterExtractor;
    switch(mode) {
        case REF_CURSOR:
            refCursorExtractor = new JdbcCallRefCursorExtractorImpl(name, startIndex);
            parameterBinder = null;
            parameterExtractor = null;
            break;
        case IN:
            parameterBinder = getParameterBinder(typeToUse, name);
            parameterExtractor = null;
            refCursorExtractor = null;
            break;
        case INOUT:
            parameterBinder = getParameterBinder(typeToUse, name);
            parameterExtractor = new JdbcCallParameterExtractorImpl<>(procedureCall.getProcedureName(), name, startIndex, typeToUse);
            refCursorExtractor = null;
            break;
        default:
            parameterBinder = null;
            parameterExtractor = new JdbcCallParameterExtractorImpl<>(procedureCall.getProcedureName(), name, startIndex, typeToUse);
            refCursorExtractor = null;
            break;
    }
    return new JdbcCallParameterRegistrationImpl(name, startIndex, mode, typeToUse, parameterBinder, parameterExtractor, refCursorExtractor);
}
Also used : JdbcCallRefCursorExtractorImpl(org.hibernate.sql.exec.internal.JdbcCallRefCursorExtractorImpl) JdbcCallParameterRegistrationImpl(org.hibernate.sql.exec.internal.JdbcCallParameterRegistrationImpl) JdbcParameterBinder(org.hibernate.sql.exec.spi.JdbcParameterBinder)

Aggregations

JdbcCallParameterRegistrationImpl (org.hibernate.sql.exec.internal.JdbcCallParameterRegistrationImpl)1 JdbcCallRefCursorExtractorImpl (org.hibernate.sql.exec.internal.JdbcCallRefCursorExtractorImpl)1 JdbcParameterBinder (org.hibernate.sql.exec.spi.JdbcParameterBinder)1