当前位置:K88软件开发文章中心编程语言SQLMyBatis → 文章内容

MyBatis Java API

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-18 8:46:06

red for other methods. If you specify a@SelectKeyannotation, then MyBatis will ignore any generated key properties set via the@Optionsannotation, or configuration properties. Attributes: statement an array of strings which is the SQL statement to execute,keyPropertywhich is the property of the parameter object that will be updated with the new value, before which must be eithertrueorfalseto denote if the SQL statement should be executed before or after the insert,resultTypewhich is the Java type of thekeyProperty, andstatementType=PREPARED`.@ResultMapMethodN/AThis annotation is used to provide the id of a ` element in an XML mapper to a@Selector@SelectProviderannotation. This allows annotated selects to reuse resultmaps that are defined in XML. This annotation will override any@Resultsor@ConstructorArgs` annotation if both are specified on an annotated select.@ResultTypeMethodN/AThis annotation is used when using a result handler. In that case, the return type is void so MyBatis must have a way to determine the type of object to construct for each row. If there is an XML result map, use the @ResultMap annotation. If the result type is specified in XML on the ` Night Mode映射申明样例这个例子展示了如何使用 @SelectKey 注解来在插入前读取数据库序列的值:@Insert("insert into table3 (id, name) values(#{nameId}, #{name})")@SelectKey(statement="call next value for TestSequence", keyProperty="nameId", before=true, resultType=int.class)int insertTable3(Name name);这个例子展示了如何使用 @SelectKey 注解来在插入后读取数据库识别列的值:@Insert("insert into table2 (name) values(#{name})")@SelectKey(statement="call identity()", keyProperty="nameId", before=false, resultType=int.class)int insertTable2(Name name);

上一页  [1] [2] [3] [4] [5] 


MyBatis Java API