@Target(value={TYPE,METHOD,FIELD}) @Retention(value=RUNTIME) public @interface PortableSequenceGenerator
GeneratedValue
annotation.
A portable sequence generator may be specified on the entity class or on the primary key field or property. The scope of the generator name is global to the persistence unit (across all generator types).
The term "portable" in this case indicates that native sequences will be used if the target database platform supports them. However, if it does not have native sequence support, then sequence-like behavior will be emulated using an appropriate strategy for the target platform.
Examples: @PortableSequenceGenerator(name="EMP_SEQ") @PortableSequenceGenerator(name="EMP_SEQ", sequenceName="EMP_SEQ", initialValue = 1)
Current, in order for this annotation to work properly, the
KradEclipseLinkCustomizer
must be configured for the EclipseLink
persistence unit. This can be done manually using
PersistenceUnitProperties.SESSION_CUSTOMIZER
, or it will be done automatically
when using KradEclipseLinkEntityManagerFactoryBean
.
Modifier and Type | Required Element and Description |
---|---|
String |
name
(Required) A unique generator name that can be referenced by one or more classes to be the generator for primary
key values.
|
Modifier and Type | Optional Element and Description |
---|---|
int |
initialValue
(Optional) The value from which the sequence object is to start generating.
|
String |
sequenceName
(Optional) The name of the database sequence object from which to obtain primary key values.
|
public abstract String sequenceName
public abstract int initialValue
If the sequence construct already exists in the database or schema generation is not enabled, then this value is effectively ignored.
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.