When an integer field is part of a primary_key and defined as
"noentry" or nodisplay, it is assumed to be an auto_increment field
and reset to "" before an insert. This is wrong when the field is a
link to another table. The real solution would be to get the
"Auto_increment" attribute from Mysql. The current workaround is not
to define such a field as "noentry" or nodisplay.