001package com.avaje.ebean.config; 002 003/** 004 * Defines the mode for JDBC batch processing. 005 * <p> 006 * Used both at a per transaction basis and per request basis. 007 * </p> 008 * 009 * @see com.avaje.ebean.config.ServerConfig#setPersistBatch(PersistBatch) 010 * @see com.avaje.ebean.config.ServerConfig#setPersistBatchOnCascade(PersistBatch) 011 * 012 * @see com.avaje.ebean.Transaction#setBatch(PersistBatch) 013 * @see com.avaje.ebean.Transaction#setBatchOnCascade(PersistBatch) 014 */ 015public enum PersistBatch { 016 017 /** 018 * Do not use JDBC Batch mode. 019 */ 020 NONE(false), 021 022 /** 023 * Use JDBC Batch mode on Inserts. 024 */ 025 INSERT(true), 026 027 /** 028 * Use JDBC Batch mode on Inserts, Updates and Deletes. 029 */ 030 ALL(true), 031 032 /** 033 * You should not use this value explicitly. It should only used on the Transactional annotation 034 * to indicate that the value should inherit from the ServerConfig setting. 035 */ 036 INHERIT(false); 037 038 039 final boolean forInsert; 040 041 PersistBatch(boolean forInsert) { 042 this.forInsert = forInsert; 043 } 044 045 /** 046 * Return true if persist cascade should use JDBC batch for inserts. 047 */ 048 public boolean forInsert() { 049 return forInsert; 050 } 051 052}