com.avaje.ebean.config.dbplatform
Interface IdGenerator

All Known Implementing Classes:
DB2SequenceIdGenerator, H2SequenceIdGenerator, OracleSequenceIdGenerator, PostgresSequenceIdGenerator, SequenceIdGenerator, SimpleSequenceIdGenerator

public interface IdGenerator

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.


Field Summary
static String AUTO_UUID
          The name of the default UUID generator.
 
Method Summary
 String getName()
          Return the name of the IdGenerator.
 boolean isDbSequence()
          Return true if this is a DB sequence.
 Object nextId()
          return the next unique identity value.
 void preAllocateIds(int allocateSize)
          Is called prior to inserting OneToMany's as an indication that a number of beans are likely to need id's shortly.
 

Field Detail

AUTO_UUID

static final String AUTO_UUID
The name of the default UUID generator.

See Also:
Constant Field Values
Method Detail

getName

String getName()
Return the name of the IdGenerator. For sequences this is the sequence name.


isDbSequence

boolean isDbSequence()
Return true if this is a DB sequence.


nextId

Object nextId()
return the next unique identity value.


preAllocateIds

void preAllocateIds(int allocateSize)
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.



Copyright © 2010. All Rights Reserved.