Auto-Generated Keys

One of the popular ways to design tables these days is to use sequence numbers as primary key values. Some databases let you define a column as being a sequenced value. Others include special sequencer objects. Even if the database doesn't support sequences, you can still create your own sequence table to generate the key value.

The advantage of the sequence numbers is that you don't have to worry about coming up with a unique set of keys. You can't rely on people having unique first, middle, and last names, so you must come up with an additional key to distinguish people. With a sequence number, however, you have a single key column.

Note

You can only use auto-generated keys when you have a single-column key. That is, if ...

Get Special Edition Using Java™ 2 Enterprise Edition 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.