Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340610

Summary: SQL script sequence generation from persistence.xml file - wrong starting value
Product: z_Archived Reporter: Guy Middleton <guy.middleton>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: eclipselink.orm-inbox, michael.f.obrien, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
URL: http://forums.oracle.com/forums/thread.jspa?messageID=9456862#9456862
Whiteboard:

Description Guy Middleton CLA 2011-03-21 17:35:11 EDT
Using Weblogic 11.1.1.3.0 on Linux with Toplink -- not sure which Eclipselink version this is.


I have an Entity class defined as follows:

@Entity
public class Serviceid implements Serializable {
    /* ... */
    @Id
    @Column(name = "SERVICEID_SEQ", nullable = false)
    @SequenceGenerator(name = "SEQ_SERVICEID", sequenceName = "SEQ_SERVICEID", allocationSize=1, initialValue=10000000)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_SERVICEID")
    private Integer serviceidSeq;
    /* ... */
}


Would like autogenerated SQL, here are the options in the persistence.xml file:

    <properties>
      <property name="eclipselink.target-database" value="Oracle11"/>
      <property name="eclipselink.target-server" value="WebLogic_10"/>
      <property name="javax.persistence.jtaDataSource" value="java:/app/jdbc/jdbc/NPP_IDMDS"/>
      <property name="eclipselink.ddl-generation.output-mode" value="sql-script"/>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
      <property name="eclipselink.application-location" value="/home/guy/jdeveloper/mywork/JavaPersistenceTest/TopLinkTest/src/META-INF/"/>
    </properties>


When I run my application, Toplink writes a createDDL.jdbc file:
CREATE TABLE SERVICEID (SERVICEID_SEQ NUMBER(10) NOT NULL, COUNT_HWDEVICES NUMBER(10) NULL, SERVICE_CLASS VARCHAR2(10) NULL, SERVICEID_VALUE VARCHAR2(20) NULL, CREATE_DATE TIMESTAMP NULL, SERVICEID_TYPE VARCHAR2(10) NULL, COUNT_SWDEVICES NUMBER(10) NULL, PRIMARY KEY (SERVICEID_SEQ))
CREATE SEQUENCE SEQ_SERVICEID START WITH 1


Based on the "initialValue=10000000" parameter in my @SequenceGenerator tag, I would expect the sequence to start with 10000000, but instead it starts with 1.
Comment 1 Tom Ware CLA 2011-04-06 08:28:55 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:28:07 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink