1 package org.hibernate.param; 3 4 import org.hibernate.engine.QueryParameters; 5 import org.hibernate.engine.SessionImplementor; 6 import org.hibernate.engine.TypedValue; 7 8 import java.sql.PreparedStatement ; 9 import java.sql.SQLException ; 10 11 16 public class NamedParameterSpecification implements ParameterSpecification { 17 18 private final String name; 19 20 public NamedParameterSpecification(String name) { 21 this.name = name; 22 } 23 24 34 public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) 35 throws SQLException { 36 TypedValue typedValue = ( TypedValue ) qp.getNamedParameters().get( name ); 37 typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); 38 return typedValue.getType().getColumnSpan( session.getFactory() ); 39 } 40 } 41 | Popular Tags |