Just found this really nice tutorial.. I'm trying it now, hopefully
it'll work. :) Thank you all!
http://www.oracle.com/technology/products/ias/toplink/jpa/howto/id-generation.html
Fernando Padilla wrote:
Sorry. :)
I am new to JPA and mostly trying to 'port' our code from using Kodo,
while still using the old kodo schema, etc..
So I've got most of my mappings setup and working, but for reading only,
since writing requires a properly setup sequence generator.
My next step is to setup the JPA "SequenceGenerator" to work like the
one we currently have. We had Kodo setup to use a single global
Sequence, for all objects. It stored it in a single row within a single
table (sql below). So any hints or tips? Would setting a sequence like
this be doable using standard JPA metadata, or would it be OpenJPA
specific? I freely admit that I'm a newb, and will figure it out at
some point, but any help, leads, urls to read, or keywords to search
would be appreciated, since it will help me go faster. :)
mysql> desc JDO_SEQUENCE;
+----------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+
| ID | tinyint(4) | NO | PRI | 0 | |
| SEQUENCE_VALUE | bigint(20) | YES | | NULL | |
+----------------+------------+------+-----+---------+-------+
mysql> select * from JDO_SEQUENCE;
+----+----------------+
| ID | SEQUENCE_VALUE |
+----+----------------+
| 0 | 183622200 |
+----+----------------+
Pinaki Poddar wrote:
how to override the Sequence generator to behave like the old Kodo. Any
tips or hints on that??
Please elaborate on what you intend to do before I can comment.