0

When I delete a record it shows an weird error,

"unknown column 'id' in 'where clause'. DELETE FROM tableName WHERE id='' null"

Something like that. The error seems to be self explanatory, BUT in my table I dont have a column id.

Table Structure:

  • Code
  • Name
  • UserGroup

Why is ActiveJDBC searching an column id?

The error disappears when I added column id in my table. But still its weird.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

1 Answers1

0

Because this is a requirement of the framework. Did you read the documentation: http://javalite.io/surrogate_primary_keys ?

If you want to delete the parent, and then children with it, there are many ways to do this. One is to use the framework: http://javalite.io/delete_cascade

The other is to use a DB mechanism: MySQL delete on cascade

Additionally, please really study relationships and read the docs before imoplementing: http://javalite.io/one_to_many_associations

Good luck!

ipolevoy
  • 5,432
  • 2
  • 31
  • 46