You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by jones henry <sj...@hotmail.com> on 2004/03/05 18:33:37 UTC
Torque Example Runtime Problem
All,
This is the followup to my previous email.. I find out the code that causes
the problem. The following code is the problem. When I tried to use either
the foreign key directly (that was the original example code) or use the
object, it errors out and gave me the error. When I commnet out creating the
new Book, everything is working fine.
Book tcpip = new Book();
tcpip.setTitle("TCP/IP Illustrated, Volume 1");
tcpip.setISBN("0-201-63346-9");
//tcpip.setPublisherId(addison.getPublisherId());
tcpip.setPublisher(addison);
//tcpip.setAuthorId(stevens.getAuthorId());
tcpip.setAuthor(stevens);
tcpip.save();
Now I am wondering whether anything is broken in torque-3.1 itself. Since
the example itself is not working. For me it seems to be a problem in torque
itself.
The error is
[DEBUG] IDBroker - -IDBroker thread was started.
[DEBUG] IDBroker - -Forced id retrieval - no available list
[DEBUG] IDBroker - -updateQuantity: UPDATE ID_TABLE SET QUANTITY = 10 WHERE
TABLE_NAME = 'publisher'
[DEBUG] IDBroker - -updateNextId: UPDATE ID_TABLE SET NEXT_ID = 1030 WHERE
TABLE_NAME = 'publisher'
[DEBUG] IDBroker - -Forced id retrieval - no available list
[DEBUG] IDBroker - -updateQuantity: UPDATE ID_TABLE SET QUANTITY = 10 WHERE
TABLE_NAME = 'author'
[DEBUG] IDBroker - -updateNextId: UPDATE ID_TABLE SET NEXT_ID = 1030 WHERE
TABLE_NAME = 'author'
java.sql.SQLException: Invalid argument value, message from server:
"Duplicate entry '0' for key 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2030)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1750)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1596)
at com.workingdogs.village.Record.saveWithInsert(Unknown Source)
at com.workingdogs.village.Record.save(Unknown Source)
at com.workingdogs.village.Record.save(Unknown Source)
at org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:899)
at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:742)
at com.kazmier.om.BaseBookPeer.doInsert(BaseBookPeer.java:223)
at com.kazmier.om.BaseBookPeer.doInsert(BaseBookPeer.java:573)
at com.kazmier.om.BaseBook.save(BaseBook.java:516)
at com.kazmier.om.BaseBook.save(BaseBook.java:480)
at com.kazmier.om.BaseBook.save(BaseBook.java:460)
at com.kazmier.Bookstore.main(Bookstore.java:51)
rethrown as org.apache.torque.TorqueException: Invalid argument value,
message from server: "Duplicate entry '0' for key 1"
at org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:236)
at org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:903)
at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:742)
at com.kazmier.om.BaseBookPeer.doInsert(BaseBookPeer.java:223)
at com.kazmier.om.BaseBookPeer.doInsert(BaseBookPeer.java:573)
at com.kazmier.om.BaseBook.save(BaseBook.java:516)
at com.kazmier.om.BaseBook.save(BaseBook.java:480)
at com.kazmier.om.BaseBook.save(BaseBook.java:460)
at com.kazmier.Bookstore.main(Bookstore.java:51)
Caused by: java.sql.SQLException: Invalid argument value, message from
server: "Duplicate entry '0' for key 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2030)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1750)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1596)
at com.workingdogs.village.Record.saveWithInsert(Unknown Source)
at com.workingdogs.village.Record.save(Unknown Source)
at com.workingdogs.village.Record.save(Unknown Source)
at org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:899)
... 7 more
Please let me know if anyone find a solution for this.
Jones.
_________________________________________________________________
Store more e-mails with MSN Hotmail Extra Storage – 4 plans to choose from!
http://click.atdmt.com/AVE/go/onm00200362ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org