persistence@glassfish.java.net

Re: specifying sequence starting number in DescriptorCustomizer

From: James Sutherland <jamesssss_at_yahoo.com>
Date: Mon, 22 Oct 2007 08:11:40 -0700 (PDT)

The starting number is set when you create the sequence on the database, you
just need to set this in your DDL.
If you are using TopLink to create your tables, then you just need to set
the initialValue in your SequenceGenerator (you can still define the
sequence generator in annotations).


When using the following workaround for GeneratedValue on a non-id field, is
it possible
to specify the starting number in the sequence?

[Quote]
As a workaround you can enable this using the TopLink Essentials descriptor
API. Specify a DescriptorCustomizer in your persistence.xml.

public class MyDescriptorCustomizer implements DescriptorCustomizer {
  public void customize(ClassDescriptor descriptor) {
    descriptor.setSequenceNumberName("OWNER_SEQ");
    descriptor.setSequenceNumberFieldName("number");
  }
}
[Quote]


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.oracle.com/technology/products/ias/toplink/ Oracle TopLink , 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  https://glassfish.dev.java.net/javaee5/persistence/ TopLink
Essentials 
Wiki:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence , 
http://wiki.eclipse.org/EclipseLink EclipseLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink , 
http://www.nabble.com/java.net---glassfish-persistence-f13455.html Glassfish
Persistence 
-- 
View this message in context: http://www.nabble.com/specifying-sequence-starting-number-in-DescriptorCustomizer-tf4668237.html#a13342373
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.