Use of sequences to generate field values in JDO

#1

I'm trying to use sequences to set field values in JDO.  I want to do this in XML metadata to avoid use of annotations.

This is an example of what I'm trying:

<package name="com.spiffymap.sealog.model">
        <sequence name="audit_seq" factory-class="java.lang.Long" strategy="contiguous"/>
        <class name="Audit" identity-type="application">
            <field name="id" primary-key="true" value-strategy="sequence" sequence="audit_seq"/>

When the code is run I get the message: 

No definition of generator 'audit_seq' (referenced by field com.spiffymap.sealog.model.Audit.id) (error 341)

Can you describe how I should be using sequences to provide field values?

 

 

 

#2

It seems that the fully qualified name of this sequence is expected in the field element, i.e.

com.spiffymap.sealog.model.audit_seq

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login