com.avaje.ebeaninternal.server.persist.BatchedBeanHolder Maven / Gradle / Ivy
package com.avaje.ebeaninternal.server.persist;
import com.avaje.ebeaninternal.server.core.PersistRequest;
import com.avaje.ebeaninternal.server.core.PersistRequestBean;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import java.util.ArrayList;
import java.util.IdentityHashMap;
/**
* Holds lists of persist requests for beans of a given type.
*
* This is used to delay the actual binding of the bean to PreparedStatements.
* The reason is that we don't have all the bind values yet in the case of inserts
* with getGeneratedKeys.
*
*
* Has a depth which is used to determine the order in which it should be
* executed. The lowest depth is executed first.
*
*/
public class BatchedBeanHolder {
private static final Object DUMMY = new Object();
/**
* The owning queue.
*/
private final BatchControl control;
private final String shortDesc;
/**
* The 'depth' which is used to determine the execution order.
*/
private final int order;
/**
* The list of bean insert requests.
*/
private ArrayList inserts;
/**
* The list of bean update requests.
*/
private ArrayList updates;
/**
* The list of bean delete requests.
*/
private ArrayList deletes;
/**
* Set of beans in this batch. This is used to ensure that a single bean instance is not included
* in the batch twice (two separate insert requests etc).
*/
private final IdentityHashMap