Juan Felipe Narvaez Wed Feb 15 05:40:44 -0500 2012

Subject: Problem with update a table that dont have any auto_increment id

Good Mornig;
I have a problem trying to update a table, i have a few attributes but i dont have any attribute called "id" and auto_increment either.
I've tried update the table with "save" but the orm try to save a new register, then throw me a exception by duplicate primary key. The Question is ┬┐How can i to update a table with a sentences example WHERE Cod_ev = 'any'?
Thanks I hope prompt response!

Nanne Huiges Wed Feb 15 09:00:14 -0500 2012

If you get the error "duplicate primary key" you have a primary key in your table, but try to save a value that is allready there. I suspect, because you claim to have no auto_increment, that you don't assign it a unique value, so it tries to save something default (like '0').

some possible sollutions:
  • Make your primary key auto-increment
  • Manually assign a value to the key instead of leaving it empty

What this has to do with "updating a table" with a where is beyond me.