Entity beans and primary keys
posted 15 years ago
The EJB Primary key has no actual connection with database keys - it's merely an object that uniquely defines a bean instance. It's common to use a database primary key field, since by definition that ALSO is valid, but there's no absolute requirement. I had a fairly extensive project where there WAS no single database field that uniquely defined a table row, but by combining 2 columns to make the EJB primary key I could map 1 bean to one row.