When I build a persistence unit for a set of entity classes that correspond to
an existing database (again, in my case, I was using the TRAVEL example database
that ships with Creator 2 Update 1), I wanted to take advantage of the ability
to autogenerate primary key values. When I deployed an application using these
classes the first time, it created a SEQUENCE table for me (good). But the
starting value it stored in the SEQ_COUNT column was within a range of primary
key values that were used by existing rows in the database (bad), so I got a
"duplicate key" error the first time I tried to insert a new row.
Workaround is to manually adjust the stored sequence number to something larger
than the highest used key in any of the existing tables represented in this
persistence unit. But that is something the JPA architecture should do for me,
so I don't have to.