Package org.jdbi.v3.sqlobject.customizer
Annotation Type DefineList
-
@Retention(RUNTIME) @Target(PARAMETER) public @interface DefineListDefines a named attribute as a comma-separatedStringfrom the elements of the annotated array orListargument. Attributes are stored on theStatementContext, and may be used by the template engine. For example:@SqlUpdate("insert into <table> (<columns>) values (<values>)") int insert(@Define String table, @DefineList List<String> columns, @BindList List<Object> values); @SqlQuery("select <columns> from <table> where id = :id") ResultSet select(@DefineList("columns") List<String> columns, @Define("table") String table, @Bind("id") long id);An array or
Listargument passed to@DefineListwill be converted to a comma-separated String and set as a whole as a single specified attribute. Duplicate members in theListmay cause SQL exceptions. An emptyListornullmembers in theListwill result in anIllegalArgumentException.Be aware of the list members you're binding with @DefineList, as there is no input sanitization! Blindly passing Strings through
@DefineListmay make your application vulnerable to SQL Injection.- See Also:
Define
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringvalueThe attribute name to define.
-