11.6. Handling data sets with no natural primary key
This section is included here because it related equally to both container-managed and bean-managed persistence. However, the issues described are rather subtle, and you may prefer to come back to this section after reading about BMP and CMP (and/or writing some code!).
We have already discussed the importance of the notion of a ‘primary key’ to the entity EJB architecture. We must now examine ways to handle situations in which the data set has no ‘natural’ primary key—that is, for example, where no single column uniquely identifies a particular row in a database table.
If a database table does not have a natural primary key, we must find a way to generate one. Consider, for example, a table ...
Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.