You will need a SessionCustomizer that allows you to customize the Sequences.
Persistence.xml entry:
<property name="toplink.session.customizer" value="mypackage.MySequenceCustomizer"/>
Customizer Class :
package mypackage;
import oracle.toplink.essentials.sessions.Session;
/**
* PUBLIC:
* This interface is to allow extra customization on a TopLink Session
*/
public class MySequenceCustomizer extends SessionCustomizer {
public void customize(Session session) throws Exception {
session.getDatasourcePlatform().getSequence("OWNER_SEQ").setInitialValue(2);
}
}
--Gordon
-----Original Message-----
From: sud [mailto:to_sud_at_yahoo.com]
Sent: Sunday, October 21, 2007 9:18 PM
To: persistence_at_glassfish.dev.java.net
Subject: specifying sequence starting number in DescriptorCustomizer
When using the following workaround for GeneratedValue on a non-id field, is it possibleto specify the starting number in the sequence?[Quote]As a workaround you can enable this using the TopLink Essentials descriptorAPI. 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]
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com