@Override public int getColumnSpan(Mapping mapping) throws MappingException { return underlyingType.getColumnSpan( mapping ); } }
@Override public int getColumnSpan(Mapping mapping) throws MappingException { int span = 0; for ( int i = 0; i < propertySpan; i++ ) { span += propertyTypes[i].getColumnSpan( mapping ); } return span; }
/** * Retrieve the number of columns represented by this type. * * @param type The type. * * @return The number of columns. */ public int getColumnSpan(Type type) { return type.getColumnSpan( sfi ); }
@Override public int getColumnSpan(Mapping mapping) throws MappingException { return baseType.getColumnSpan(mapping); }
private int getColumnSpan(Type type, SessionFactoryImplementor sfi) { int columnSpan = type.getColumnSpan( sfi ); if ( columnSpan == 0 && type instanceof OneToOneType ) { columnSpan = ( (OneToOneType) type ).getIdentifierOrUniqueKeyType( sfi ).getColumnSpan( sfi ); } return columnSpan; }
public static String[][] generateColumnNames(Type[] types, SessionFactoryImplementor f) throws MappingException { String[][] columnNames = new String[types.length][]; for ( int i = 0; i < types.length; i++ ) { int span = types[i].getColumnSpan( f ); columnNames[i] = new String[span]; for ( int j = 0; j < span; j++ ) { columnNames[i][j] = NameGenerator.scalarName( i, j ); } } return columnNames; }
@Override public int getColumnSpan(Mapping mapping) throws MappingException { Type[] types = userType.getPropertyTypes(); int n = 0; for ( Type type : types ) { n += type.getColumnSpan( mapping ); } return n; }
@Override public int getColumnSpan(Mapping mapping) throws MappingException { return requireIdentifierOrUniqueKeyType( mapping ).getColumnSpan( mapping ); }
public int getColumnSpan(Mapping mapping) throws MappingException { return super.getIdentifierOrUniqueKeyType( mapping ).getColumnSpan( mapping ); }
public String getRenderText(SessionFactoryImplementor sessionFactory) { int count = 0; if ( getExpectedType() != null && ( count = getExpectedType().getColumnSpan( sessionFactory ) ) > 1 ) { StringBuilder buffer = new StringBuilder(); buffer.append( "(?" ); for ( int i = 1; i < count; i++ ) { buffer.append( ", ?" ); } buffer.append( ")" ); return buffer.toString(); } else { return "?"; } } }
private static int bindPositionalParameters( final PreparedStatement st, final Object[] values, final Type[] types, final int start, final SessionImplementor session) throws SQLException, HibernateException { int span = 0; for ( int i = 0; i < values.length; i++ ) { types[i].nullSafeSet( st, values[i], start + span, session ); span += types[i].getColumnSpan( session.getFactory() ); } return span; }
public boolean isValid(Mapping mapping) throws MappingException { return getColumnSpan()==getType().getColumnSpan(mapping); }
@Override public void nullSafeSet(PreparedStatement st, Object value, int begin, SharedSessionContractImplementor session) throws HibernateException, SQLException { Object[] subvalues = nullSafeGetValues( value, entityMode ); for ( int i = 0; i < propertySpan; i++ ) { propertyTypes[i].nullSafeSet( st, subvalues[i], begin, session ); begin += propertyTypes[i].getColumnSpan( session.getFactory() ); } }
@Override public int bind( PreparedStatement statement, QueryParameters qp, SharedSessionContractImplementor session, int position) throws SQLException { final Object value = qp.getNamedParameters().get( PARAM_KEY ).getValue(); keyType.nullSafeSet( statement, value, position, session ); return keyType.getColumnSpan( session.getFactory() ); }
@Override public int bind( PreparedStatement statement, QueryParameters qp, SharedSessionContractImplementor session, int position) throws SQLException { final TypedValue typedValue = qp.getNamedParameters().get( Integer.toString( label ) ); typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); return typedValue.getType().getColumnSpan( session.getFactory() ); } }
@Override public int bind( PreparedStatement statement, QueryParameters qp, SharedSessionContractImplementor session, int position) throws SQLException { final TypedValue typedValue = qp.getNamedParameters().get( Integer.toString( label ) ); typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); return typedValue.getType().getColumnSpan( session.getFactory() ); } }
/** * Bind the appropriate value into the given statement at the specified position. * * @param statement The statement into which the value should be bound. * @param qp The defined values for the current query execution. * @param session The session against which the current execution is occuring. * @param position The position from which to start binding value(s). * * @return The number of sql bind positions "eaten" by this bind operation. */ @Override public int bind(PreparedStatement statement, QueryParameters qp, SharedSessionContractImplementor session, int position) throws SQLException { final TypedValue typedValue = qp.getNamedParameters().get( Integer.toString( label ) ); typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); return typedValue.getType().getColumnSpan( session.getFactory() ); }
@Override public int bind( PreparedStatement statement, QueryParameters qp, SharedSessionContractImplementor session, int position) throws SQLException { final TypedValue typedValue = qp.getNamedParameters().get( name ); typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); return typedValue.getType().getColumnSpan( session.getFactory() ); } }
@Override public int bind( PreparedStatement statement, QueryParameters qp, SharedSessionContractImplementor session, int position) throws SQLException { final TypedValue typedValue = qp.getNamedParameters().get( name ); typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); return typedValue.getType().getColumnSpan( session.getFactory() ); } }
@Override public void initialize() { // TODO : this really needs to be delayed until after we definitively know the operand node type; // where this is currently a problem is parameters for which where we cannot unequivocally // resolve an expected type Type operandType = extractDataType( getOperand() ); if ( operandType == null ) { return; } SessionFactoryImplementor sessionFactory = getSessionFactoryHelper().getFactory(); int operandColumnSpan = operandType.getColumnSpan( sessionFactory ); if ( operandColumnSpan > 1 ) { mutateRowValueConstructorSyntax( operandColumnSpan ); } }