io.ebean.config.dbplatform.PlatformIdGenerator 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.ebean.config.dbplatform;
import io.ebean.Transaction;
/**
* Generates unique id's for objects. This occurs prior to the actual insert.
*
* Note that many databases have sequences or auto increment features. These can
* be used rather than an IdGenerator and are different in that they occur
* during an insert. IdGenerator is used to generate an id BEFORE the
* actual insert.
*
*/
public interface PlatformIdGenerator {
/**
* The name of the default UUID generator.
*/
String AUTO_UUID = "auto.uuid";
/**
* Return the name of the IdGenerator. For sequences this is the sequence
* name.
*/
String getName();
/**
* Return true if this is a DB sequence.
*/
boolean isDbSequence();
/**
* return the next unique identity value.
*
* Note the transaction passed in can be null.
*
*/
Object nextId(Transaction transaction);
/**
* Is called prior to inserting OneToMany's as an indication that a number of
* beans are likely to need id's shortly.
*
* Can be used as a performance optimisation to prefetch a number of Id's.
* Especially when the allocateSize is very large.
*
*/
void preAllocateIds(int allocateSize);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy