@Documented @Retention(value=RUNTIME) @Target(value=METHOD) @Repeatable(value=SelectKey.List.class) public @interface SelectKey
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); }
Modifier and Type | Required Element and Description |
---|---|
boolean |
before
Returns whether retrieves a key value before executing insert/update statement.
|
String |
keyProperty
Returns property names that holds a key value.
|
Class<?> |
resultType
Returns the key value type.
|
String[] |
statement
Returns an SQL for retrieving a key value.
|
Modifier and Type | Optional Element and Description |
---|---|
String |
databaseId |
String |
keyColumn
Returns column names that retrieves a key value.
|
StatementType |
statementType
Returns the statement type to use.
|
public abstract String[] statement
public abstract String keyProperty
If you specify multiple property, please separate using comma(',').
public abstract boolean before
true
if execute before; false
if otherwisepublic abstract Class<?> resultType
public abstract String keyColumn
If you specify multiple column, please separate using comma(',').
public abstract StatementType statementType
public abstract String databaseId
Copyright © 2009–2021 MyBatis.org. All rights reserved.