openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Custom ID Generator
Date Tue, 20 Aug 2013 16:28:54 GMT
Hi Malte,
Welcome to OpenJPA!

Maybe this is old information since you have already been experimenting
with the id generation, but I would first point you at this information.
Basic id generation is documented here:
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_meta_gen

>From here, there is some information on the various built-in generators:
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_sequence

Since it sounds like you have a unique case for the table generator, you
might want to consider extending the OpenJPA table generator and substitute
your unique processing:

*You can use JPA SequenceGenerators to describe any built-in Seqs or your
own Seq implementation. Set the sequenceName attribute to a plugin string
describing your choice. *
* *

* *

* If specifying your own class name, you must include parentheses at the
end of the class name, even if you have no plugin properties to configure.
(E.g., sequenceName="com.example.SeqImpl()". *

http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_mapping_sequence

Hope this helps!
Kevin


On Sun, Aug 18, 2013 at 1:06 PM, Malte <malte.neumann@googlemail.com> wrote:

> Hi !
>
> I'm new to JPA (and OpenJPA). For a new project i consider to use OpenJPA
> as the persistence layer. During my investigations, I came across a problem.
>
> The existing system uses a table id generator. The ID saved in the
> id-table is always the last used id. The OpenJPA table-id-generator assumes
> that this is the next available id. I can't change the behaviour of the old
> system, so I'm looking for a solution in the OpenJPA System.
>
> I've been looking for a way to implement a custom id generator, but i
> can't find any working example. Is it even possible to implement a custom
> generator?
>
> Regards
> Malte
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message