Package org.apache.ibatis.annotations
Annotation Type SelectKey
- 
@Documented @Retention(RUNTIME) @Target(METHOD) @Repeatable(List.class) public @interface SelectKey
The annotation that specify an SQL for retrieving a key value.How to use:
public interface UserMapper { @SelectKey(statement = "SELECT identity('users')", keyProperty = "id", before = true, resultType = int.class) @Insert("INSERT INTO users (id, name) VALUES(#{id}, #{name})") boolean insert(User user); }- Author:
 - Clinton Begin
 
 
- 
- 
Required Element Summary
Required Elements Modifier and Type Required Element Description booleanbeforeReturns whether retrieves a key value before executing insert/update statement.StringkeyPropertyReturns property names that holds a key value.Class<?>resultTypeReturns the key value type.String[]statementReturns an SQL for retrieving a key value. 
- 
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description StringdatabaseIdStringkeyColumnReturns column names that retrieves a key value.StatementTypestatementTypeReturns the statement type to use. 
 - 
 
- 
- 
Element Detail
- 
statement
String[] statement
Returns an SQL for retrieving a key value.- Returns:
 - an SQL for retrieving a key value
 
 
 - 
 
- 
- 
keyProperty
String keyProperty
Returns property names that holds a key value.If you specify multiple property, please separate using comma(',').
- Returns:
 - property names that separate with comma(',')
 
 
 - 
 
- 
- 
resultType
Class<?> resultType
Returns the key value type.- Returns:
 - the key value type
 
 
 - 
 
- 
- 
keyColumn
String keyColumn
Returns column names that retrieves a key value.If you specify multiple column, please separate using comma(',').
- Returns:
 - column names that separate with comma(',')
 
- Default:
 - ""
 
 
 - 
 
- 
- 
statementType
StatementType statementType
Returns the statement type to use.- Returns:
 - the statement type
 
- Default:
 - org.apache.ibatis.mapping.StatementType.PREPARED
 
 
 - 
 
- 
- 
databaseId
String databaseId
- Returns:
 - A database id that correspond this select key
 - Since:
 - 3.5.5
 
- Default:
 - ""
 
 
 - 
 
 -