Hi,

I'd like to know what's the best way (and how) to use sequences for
the primary keys of my persistent classes.

I'm facing some problems I can't seem to solve: I can't manage to
store my objects, and I get an exception like:

KeyConstraintViolatedException: SQL failure while insert object data
for class com.inetpsa.ae6.concept.Sentence, PK of the given object is
[ id=2], object was [myobject tostring], exception message is
[ORA-01400: cannot insert NULL into ("USER"."TABLE"."COLUMN")

There's nothing in that table yet. But there are some other objects
inserted by some scripts in other tables (dunno if that matters).

I've specified the sequence-manager like so:

<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
    <attribute attribute-name="autoNaming" attribute-value="true"/>
    <attribute attribute-name="globalSequenceStart" attribute-value="1000"/>
</sequence-manager>

(notice I tried using the globalSequenceStart, but it doesn't seem to
change a thing)

On my base class's id field, I did:
@ojb.field column="ID" jdbc-type="BIGINT" primarykey="true"
    autoincrement="database" sequence-name="seq1"

(whether I name my sequence or not doesn't matter either, and anyway
I've set autoNaming to true)

And xDoclet generated the following mapping snippet:

    <field-descriptor
        name="id"        column="ID"
        jdbc-type="BIGINT"        primarykey="true"
        autoincrement="true"        sequence-name="seq1"
        access="readonly"
    >

Other information: I'm using OJB 1.0.3 with Oracle9i.
I'm probably doing something wrong somewhere, but unfortunately, I
don't know what :-(
Any help or hints are welcome! TIA.

-- 
Guillaume Laforge
http://glaforge.free.fr/weblog/?catid=2

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to