I'm having a problem using torque for a simple database.
(BWhen I try to save new rows into the database, Torque dies with an exception.
(BI'm simply creating a torque object and then calling save() on it since the table 
(Bitself has only the primary key.
(BI'm using the id broker so I shouldn't have to set anything on the object at all, 
(Bright?
(B
(B
(BMy schema file:
(B---------------------------------------------------------------------
(B<database
(B    name="imagedb"
(B    defaultJavaNamingMethod="javaname"
(B    defaultIdMethod="idbroker">
(B...
(B  <table name="Image" description="An image">
(B    <column
(B        name="imageId"
(B        required="true"
(B        primaryKey="true"
(B        type="INTEGER"
(B        description="Unique ID"/>
(B  </table>
(B</database>
(B---------------------------------------------------------------------
(B
(B
(BThe code in question:
(B---------------------------------------------------------------------
(Bpublic class ImagePersistence {
(B...
(B    public int addImage() {
(B...
(B        Image image = new Image();
(B        image.save();  // <-- dies here
(B...
(B    }
(B}
(B---------------------------------------------------------------------
(B
(B
(BThe exception thrown:
(B---------------------------------------------------------------------
(BCaused by: org.apache.torque.TorqueException: Database insert attempted without 
(Banything specified to insert
(B        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:691)
(B        at com.somewhere.imagedb.data.BaseImagePeer.doInsert(BaseImagePeer.java:209)
(B        at com.somewhere.imagedb.data.BaseImagePeer.doInsert(BaseImagePeer.java:551)
(B        at com.somewhere.imagedb.data.BaseImage.save(BaseImage.java:483)
(B        at com.somewhere.imagedb.data.BaseImage.save(BaseImage.java:447)
(B        at com.somewhere.imagedb.data.BaseImage.save(BaseImage.java:427)
(B        at 
(Bcom.somewhere.imagedb.data.ImagePersistence.addImage(ImagePersistence.java:21)
(B        ... 46 more
(B---------------------------------------------------------------------
(B
(B
(B
(B---------------------------------------------------------------------
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to