public enum IdGen extends Enum<IdGen>
Setup up an EntityInterceptor on PrePersist events that generates an incremental
ID.
{
use(new Monphia().with(IdGen.GLOBAL);
}
ID must be of type: Long and annotated with GeneratedValue:
@Entity
public class MyEntity {
@Id @GeneratedValue Long id;
}
| Enum Constant and Description |
|---|
GLOBAL
A global unique ID regardless of the entity type.
|
LOCAL
A unique ID per entity type.
|
| Modifier and Type | Method and Description |
|---|---|
abstract String |
value(Class<?> mappedClass)
Get an unique value for the given mapped class.
|
static IdGen |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static IdGen[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final IdGen GLOBAL
public static final IdGen LOCAL
public static IdGen[] values()
for (IdGen c : IdGen.values()) System.out.println(c);
public static IdGen valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2016. All rights reserved.