Class EntityParameterBinder
java.lang.Object
tech.guilhermekaua.spigotboot.data.jdbc.repository.mapper.EntityParameterBinder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbindIdParameters(PreparedStatement ps, Object id, int startIndex) intbindInsertParameters(PreparedStatement ps, Object entity) intbindInsertParameters(PreparedStatement ps, Object entity, boolean skipIdentityId) intbindUpdateParameters(PreparedStatement ps, Object entity) intbindUpdateParameters(PreparedStatement ps, Object entity, int additionalColumnsCount) Binds parameters for an UPDATE statement whose SET clause is ordered as: [non-id columns] [additionalColumnsCount FK placeholders] WHERE [id columns].
-
Constructor Details
-
EntityParameterBinder
-
-
Method Details
-
bindInsertParameters
public int bindInsertParameters(PreparedStatement ps, Object entity, boolean skipIdentityId) throws SQLException - Throws:
SQLException
-
bindInsertParameters
- Throws:
SQLException
-
bindUpdateParameters
- Throws:
SQLException
-
bindUpdateParameters
public int bindUpdateParameters(PreparedStatement ps, Object entity, int additionalColumnsCount) throws SQLException Binds parameters for an UPDATE statement whose SET clause is ordered as: [non-id columns] [additionalColumnsCount FK placeholders] WHERE [id columns].Non-id columns are bound first. The
additionalColumnsCountFK placeholder positions are skipped so that the id columns land at the correct WHERE offset. The method returns the index of the first FK placeholder so the caller can bind those values immediately after (e.g. viabindJoinColumnParameters).- Parameters:
additionalColumnsCount- number of extra (FK) placeholder positions that appear in the SET clause after the non-id columns and before the WHERE id placeholder(s)- Returns:
- the bind index of the first FK placeholder (i.e. one past the last non-id column)
- Throws:
SQLException
-
bindIdParameters
- Throws:
SQLException
-
extractId
-
getIdColumns
-