protected void bindParameters( SharedSessionContractImplementor session, PreparedStatement ps, Object entity) throws SQLException { Object uniqueKeyValue = persister.getPropertyValue( entity, uniqueKeyPropertyName ); uniqueKeyType.nullSafeSet( ps, uniqueKeyValue, 1, session ); }
/** * Write the identifier to a JDBC <tt>PreparedStatement</tt> */ public int writeIdentifier(PreparedStatement st, Object id, int i, SharedSessionContractImplementor session) throws HibernateException, SQLException { getIdentifierType().nullSafeSet( st, id, i, session ); return i + 1; }
@Override public void nullSafeSet( PreparedStatement st, Object value, int index, boolean[] settable, SharedSessionContractImplementor session) throws HibernateException, SQLException { if ( settable[0] ) { nullSafeSet(st, value, index, session); } }
/** * Write the key to a JDBC <tt>PreparedStatement</tt> */ protected int writeKey(PreparedStatement st, Serializable key, int i, SharedSessionContractImplementor session) throws HibernateException, SQLException { if ( key == null ) { throw new NullPointerException( "null key for collection: " + navigableRole.getFullPath() ); // an assertion } getKeyType().nullSafeSet( st, key, i, session ); return i + keyColumnAliases.length; }
/** * Write the element to a JDBC <tt>PreparedStatement</tt> */ protected int writeElement(PreparedStatement st, Object elt, int i, SharedSessionContractImplementor session) throws HibernateException, SQLException { getElementType().nullSafeSet( st, elt, i, elementColumnIsSettable, session ); return i + ArrayHelper.countTrue( elementColumnIsSettable ); }
/** * Write the element to a JDBC <tt>PreparedStatement</tt> */ protected int writeElementToWhere(PreparedStatement st, Object elt, int i, SharedSessionContractImplementor session) throws HibernateException, SQLException { if ( elementIsPureFormula ) { throw new AssertionFailure( "cannot use a formula-based element in the where condition" ); } getElementType().nullSafeSet( st, elt, i, elementColumnIsInPrimaryKey, session ); return i + elementColumnAliases.length; }
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; }
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws SQLException { requireIdentifierOrUniqueKeyType( session.getFactory() ) .nullSafeSet( st, getIdentifier( value, session ), index, session ); }
@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() ); } }
/** * Write the index to a JDBC <tt>PreparedStatement</tt> */ protected int writeIndexToWhere(PreparedStatement st, Object index, int i, SharedSessionContractImplementor session) throws HibernateException, SQLException { if ( indexContainsFormula ) { throw new AssertionFailure( "cannot use a formula-based index in the where condition" ); } getIndexType().nullSafeSet( st, incrementIndexByBase( index ), i, session ); return i + indexColumnAliases.length; }
@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() ); }
/** * Write the index to a JDBC <tt>PreparedStatement</tt> */ protected int writeIndex(PreparedStatement st, Object index, int i, SharedSessionContractImplementor session) throws HibernateException, SQLException { getIndexType().nullSafeSet( st, incrementIndexByBase( index ), i, indexColumnIsSettable, session ); return i + ArrayHelper.countTrue( indexColumnIsSettable ); }
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SharedSessionContractImplementor session) throws SQLException { if ( settable.length > 0 ) { requireIdentifierOrUniqueKeyType( session.getFactory() ) .nullSafeSet( st, getIdentifier( value, session ), index, settable, session ); } }
@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 nullSafeSet( PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { String entityName = session.getFactory().getClassMetadata((Class) value).getEntityName(); Loadable entityPersister = (Loadable) session.getFactory().getEntityPersister(entityName); underlyingType.nullSafeSet(st, entityPersister.getDiscriminatorValue(), index, session); }
protected interface InclusionChecker { boolean includeProperty(int propertyNumber); }