Package org.apache.ibatis.annotations
Annotation Type SelectKey
-
@Documented @Retention(RUNTIME) @Target(METHOD) public @interface SelectKeyThe 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.java.lang.StringkeyPropertyReturns property names that holds a key value.java.lang.Class<?>resultTypeReturns the key value type.java.lang.String[]statementReturns an SQL for retrieving a key value.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringkeyColumnReturns column names that retrieves a key value.StatementTypestatementTypeReturns the statement type to use.
-
-
-
-
statementType
StatementType statementType
Returns the statement type to use.- Returns:
- the statement type
- Default:
- org.apache.ibatis.mapping.StatementType.PREPARED
-
-