io.ebeaninternal.server.persist.BatchDepthComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.server.persist;
import java.io.Serializable;
import java.util.Comparator;
/**
* Used to sort BatchedBeanHolder by their depth.
*
* Beans are queued and put into BatchedBeanHolder along with their depth. This
* delays the actually binding to PreparedStatements until the
* BatchedBeanHolder's are flushed. This is so that we can get the generated
* keys from inserts. These values are required to persist the 'detail' beans.
*
*/
public class BatchDepthComparator implements Comparator, Serializable {
private static final long serialVersionUID = 264611821665757991L;
@Override
public int compare(BatchedBeanHolder b1, BatchedBeanHolder b2) {
if (b1.getOrder() < b2.getOrder()) {
return -1;
}
if (b1.getOrder() == b2.getOrder()) {
return 0;
}
return 1;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy