db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shevek <she...@anarres.org>
Subject Bug in sequence generation with no columns
Date Wed, 21 Apr 2004 22:35:42 GMT
Create a table with only a primary key which auto-increments.

It is impossible to insert a row into this table.

     [java] [DEBUG] BasePeer - -Elapsed time=124 ms
     [java] org.apache.torque.TorqueException: Database insert attempted 
without anything specified to insert
     [java]     at 
     [java]     at com.wordmap.nkrl.om.BaseWordsetPeer.doInsert(Unknown 
     [java]     at com.wordmap.nkrl.om.BaseWordsetPeer.doInsert(Unknown 
     [java]     at com.wordmap.nkrl.om.BaseWordset.save(Unknown Source)
     [java]     at com.wordmap.nkrl.om.BaseWordset.save(Unknown Source)
     [java]     at com.wordmap.nkrl.om.BaseWordset.save(Unknown Source)
     [java]     at com.wordmap.nkrl.setup.Initialiser.run(Unknown Source)
     [java]     at com.wordmap.nkrl.Main.main(Unknown Source)
     [java] Java Result: 1

It seems that the system builds a Criteria object and discards all the 
information about which table to insert a row into. Then it tries to 
reestablish this information from the columns in the criteria (of course 
there aren't any, because the primary key doesn't appear). And so the 
insert fails.

This should be supported, since this turned up as a normal business case. 
It isn't quite normalised, but it isn't really possible to normalise 

    486     <table
    487         name="wordset"
    488         javaName="Wordset"
    489         idMethod="native">
    491         <column
    492             name="id"
    493             javaName="Id"
    494             type="INTEGER"
    495             primaryKey="true"
    496             autoIncrement="true"
    497             required="true"
    498             />
    500         <!-- Torque can't currently cope with generating keys for
    501              tables with no non-autogenerated columns. -->
    502         <column
    503             name="dummy"
    504             javaName="Dummy"
    505             type="INTEGER"
    506             />
    507     </table>


Shevek                                    http://www.anarres.org/
I am the Borg.                         http://www.gothnicity.org/

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message