1 package org.hibernate.param; 3 4 import org.hibernate.engine.QueryParameters; 5 import org.hibernate.engine.SessionImplementor; 6 import org.hibernate.type.Type; 7 import org.hibernate.param.ParameterSpecification; 8 9 import java.sql.PreparedStatement ; 10 import java.sql.SQLException ; 11 12 17 public class PositionalParameterSpecification implements ParameterSpecification { 18 19 private final int hqlPosition; 20 21 public PositionalParameterSpecification(int hqlPosition) { 22 this.hqlPosition = hqlPosition; 23 } 24 25 35 public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) throws SQLException { 36 Type type = qp.getPositionalParameterTypes()[hqlPosition]; 37 Object value = qp.getPositionalParameterValues()[hqlPosition]; 38 39 type.nullSafeSet( statement, value, position, session ); 40 return type.getColumnSpan( session.getFactory() ); 41 } 42 } 43 | Popular Tags |