Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311328 - @SequenceGenerator initialValue on eclipselink.ddl-generation is ignored
Summary: @SequenceGenerator initialValue on eclipselink.ddl-generation is ignored
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard: submitted_patch
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-02 22:11 EDT by Yohan Yudanara CLA
Modified: 2022-06-09 10:25 EDT (History)
2 users (show)

See Also:


Attachments
Suggested patch (without test). (1.16 KB, patch)
2010-05-03 10:25 EDT, Andrei Ilitchev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yohan Yudanara CLA 2010-05-02 22:11:40 EDT
Build Identifier: 

Library: JPA 2.0 on Glassfish v3.0.
Database & JDBC: Postgresql 8.4 and postgresql-8.4-701.jdbc4 
JDK & OS: JDK 6 and Vista Home Basic.

When I'm using initialValue on @SequenceGenerator annotation and use
eclipselink.ddl-generation (create-tables) on persistence.xml, the
generated sequence always ignore the initialValue attribute.

This is my annotation:
@SequenceGenerator(name="RoleSeq",sequenceName="seq_role",initialValue=100000)

And this is the generated sequence: (start value is always *50*, not *100000*)
CREATE SEQUENCE seq_role
 INCREMENT 50
 MINVALUE 1
 MAXVALUE 9223372036854775807
 START *50*
 CACHE 1;

Reproducible: Always

Steps to Reproduce:
1. create sequence generator annotation on entity class:
@SequenceGenerator(name="RoleSeq",sequenceName="seq_role",initialValue=10000)
2. use ddl-generation on persistence.xml:
<property name="eclipselink.ddl-generation" value="create-tables"/>
3. run glassfish to make ddl running
Comment 1 Andrei Ilitchev CLA 2010-05-03 10:25:51 EDT
Created attachment 166779 [details]
Suggested patch (without test).

Note that initialValue indicates the first sequence value that the app. will use - not the start value of the sequence in the db.

If initialValue = 10000 and allocationSize = 50 the generated sequence will look like:
CREATE SEQUENCE seq_role
INCREMENT 50
START 10049

The first sequence value to be used by the app is 10049 - 50 + 1 = 10000.
Comment 2 Tom Ware CLA 2010-05-13 09:54:20 EDT
Setting target and priority.  See the following page for details of what these
values mean.

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 3 Tom Ware CLA 2010-06-11 15:35:32 EDT
suggested patch is already included in 2.1 - my tests indicate this functionality works with the patch
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:25:04 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink