db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JDigg...@genelogic.com
Subject PK-generation problems using Oracle seqs
Date Fri, 06 Dec 2002 00:57:29 GMT
All, I have a method (in turbine) that attempts to write a new object to a
torque O/R database (using torque 3.0rc2) and it's having problems w/
primary key generation using 'native' Oracle sequences for the pk keygen
(ID_TABLE IDs work fine).

Here's the table definition (the defaultIdMethod for the <database> is
'native'):

<!-- s: C V _ S P E C I E S  T A B L E -->
<table name="CV_SPECIES" description="Controlled vocabulary for species">
      <column name="species_id" required="true" primaryKey="true"
            type="INTEGER" description="Primary key for species table"/>
      <column name="name" required="true" type="VARCHAR" size="25"
            description="Species name"/>
      <unique>
            <unique-column name="name"/>
      </unique>
</table>
<!-- e: C V _ S P E C I E S  T A B L E -->

the method:

    public void doInsert(RunData data, Context context) throws Exception {
        CvSpecies entry = new CvSpecies();
        data.getParameters().setProperties(entry);
        entry.setNew(true);
        entry.save();
    }

and the error I'm getting:

java.lang.reflect.InvocationTargetException
..... <lots of reflection stuff>
Caused by: org.apache.torque.TorqueException:
ORA-01400: cannot insert NULL into
("GX_NODEDB10"."CV_SPECIES"."SPECIES_ID")
      at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:729)
      at
com.genelogic.nodedb.om.BaseCvSpeciesPeer.doInsert(BaseCvSpeciesPeer.java:192)
      at
com.genelogic.nodedb.om.BaseCvSpeciesPeer.doInsert(BaseCvSpeciesPeer.java:475)
      at com.genelogic.nodedb.om.BaseCvSpecies.save(BaseCvSpecies.java:779)
      at com.genelogic.nodedb.om.BaseCvSpecies.save(BaseCvSpecies.java:741)
      at com.genelogic.nodedb.om.BaseCvSpecies.save(BaseCvSpecies.java:721)
      at
com.genelogic.nodedb.modules.actions.admin.species.SpeciesFormActions.doInsert(SpeciesFormActions.java:45)
      ... 48 more

It looks to me like the primary key, for some reason, is not getting
generated. I have no idea why, the sequence is in the database and has not
yet been touched so whatever method the BasePeer class is supposed to run
to get the new ID doesn't seem to be happening. This is my first attempt
using native sequences w/ torque ... anyone have any suggestions? My thanks
...
-j

-------------------------------------------------
James Diggans
Bioinformatics Programmer
Gene Logic, Inc.
Phone: 301.987.1756
FAX: 301.987.1701



Mime
View raw message