15、Options类

508人浏览 / 0人评论

@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Options {
/**

  • The options for the {@link Options#flushCache()}.
  • The default is {@link FlushCachePolicy#DEFAULT}
    */

public enum FlushCachePolicy {

/** false for select statement; true for insert/update/delete statement. */
DEFAULT,
/** Flushes cache regardless of the statement type. */
TRUE,
/** Does not flush cache regardless of the statement type. */
FALSE

}

boolean useCache() default true;

FlushCachePolicy flushCache() default FlushCachePolicy.DEFAULT;

ResultSetType resultSetType() default ResultSetType.FORWARD_ONLY;

StatementType statementType() default StatementType.PREPARED;

int fetchSize() default -1;

int timeout() default -1;

boolean useGeneratedKeys() default false;

String keyProperty() default "id";

String keyColumn() default "";

String resultSets() default "";
}
这个类要注意:
(1)useGeneratedKeys,默认值是false
(2)timeout,默认值是-1,说明没有限制超时

全部评论

晴天下起了小雨
2017-10-01 18:00
很喜欢,果断关注了
wjmyly7336064
2017-10-01 18:00
相当实用,赞美了
橘大佬
2017-10-01 18:00
就是有些细节再到位点就好了…