Search code examples
databasejavadb

Assigning Foreign Keys in Java DB


Does Java DB (Derby) as set up in NetBeans allow the use of foreign keys. If so then how do you designate a particular column as a foreign key? It seems strange to me that when setting up a table's column there is a checkbox for clicking if there is a primary key but not a checkbox for clicking foreign keys.


Solution

  • You need a primary key on the main table so, its key can be used to refer to the foreign constraint. See this thread. Derby foreign key constraint