You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Michael Burschik <bu...@lotto-berlin.de> on 2005/01/20 12:12:52 UTC

Problem updating a table without a primary key

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I attempted to update entries in a table without a primary key while
using torque 3.0 and mysql 4.0.17. I tried

object.save()
ObjectPeer.doUpdate( object ), and
ObjectPeer.doUpdate( criteria )

but none of these attempts even resulted in an update event in the
database log, nor in any java application log. As soon as I added a
primary key to the table, object.save() began working as expected.

Is this a bug, or am I missing something obvious?

Regards

Michael Burschik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB75I0UCrJuMAOsMARAs5pAJ9OpTomB6755kthJkgZCT8JPUOUuACcCEmt
7nppamabDSlY7yheMmbr11w=
=YIM3
-----END PGP SIGNATURE-----


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


Re: Problem updating a table without a primary key

Posted by Hendrik Busch <he...@lexisnexis.de>.
Hi!

> I attempted to update entries in a table without a primary key while
> using torque 3.0 and mysql 4.0.17. I tried
> 
> object.save()
> ObjectPeer.doUpdate( object ), and
> ObjectPeer.doUpdate( criteria )
> 
> but none of these attempts even resulted in an update event in the
> database log, nor in any java application log. As soon as I added a
> primary key to the table, object.save() began working as expected.

I made the experience that Torque does not handle tables without a 
primary key very well because most operations are based on the pk. 
Deleting from one of those tables won't work as well, you'll get some 
KeyDefNotFoundException.

Since I didn't have the time to examine this behaviour any further, I 
now add a primary key to every table, even if it doesn't need one, just 
to keep Torque working.

 > Is this a bug, or am I missing something obvious?

See also last entry here:

http://wiki.apache.org/db-torque/TorqueProjectPages/FAQ

It's a conceptual problem.

-- 
Mit freundlichen Grüßen / Kind regards

Hendrik Busch - Senior Developer

LexisNexis Deutschland GmbH
http://www.lexisnexis.de
Feldstiege 100
D-48161 Münster
phone +49 (0) 2533-9300-455
fax +49 (0) 02533-9300-50
hendrik.busch@lexisnexis.de

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