Hello,
All of our entities inherit from "AbstractEntity" which is a MappedSuperclass
that defines an automatically generated identity column of type Long. Because
of issues we are having with GenerationType.IDENTITY
(https://issues.apache.org/jira/browse/OPENJPA-1949) I would like to switch to
GenerationType.TABLE.
When I annotate the id column in our mapped super class as
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Long id;
OpenJPA creates a sequence table with only one row (with ID 0). This means that
all our entities will share this sequence to generate new id's. This is not a
problem for our application, but I was wondering if there are any performance
issues with this. Would this be solved by defining my own tablegenerator with
an allocationSize of something like 1000?
We have existing data that is migrated to the database schema generated by
OpenJPA. Am I correct that after migration I should initialize the
SEQUENCE_VALUE to the maximum over all entity id's?
(I guess it can also be solved by pulling up the id column so that all our
entities have to define it's own id and use the same generator table. This
gives a lot of unnecessary code duplication while our design choice that all of
our entities have a synthetic id works perfectly fine for us. We use this in
many places with our notification, caching and application level lock system.)
Henno