openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: 'Standalone' Sequence Generator
Date Mon, 02 Feb 2009 16:19:42 GMT
Personally, I would recommend the use of one of OpenJPA's id generators.
I've worked with our test organizations that wanted to develop their own id
generators and they continue to run into locking and synchronization
problems.  If you can use the OpenJPA generators, then your application
doesn't have to worry about those details.  You can worry about more
important business logic than assignment of identifiers...  :-)  With
OpenJPA, you have several options for id generation [1].

Good luck,
Kevin

[1]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#jpa_overview_mapping_sequence

http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_sequence

On Mon, Feb 2, 2009 at 9:28 AM, MiƂosz Tylenda <mtylenda@o2.pl> wrote:

> Norbert,
>
> There is no such "standalone" TableGenerator in JPA but some solution to
> this has been recently posted here:
>
>
> http://n2.nabble.com/Access-Oracle-Sequence-using-OpenJPA-tp2227943p2227943.html
>
> Hope this helps.
>
> Greetings,
> Milosz
>
>
> > Hi,
> >
> > for some reason I need a sequence generator, used to create unique keys
> > explicitly.
> >
> > Is there any kind of "standalone" TableGenerator available in JPA ?
> >
> > What I want to do is something like that:
> >
> > "TableGenerator" genId = new "TableGenerator" (em, "XX") ;
> >
> > Long next = genId.getNext () ;
> >
> > myEntity.setYY (next) ; // cannot use implicit generated keys.
> >
> > Thanx a lot for your help.
> >
> > Norbert
> >
> >
> >
> >
> >
>

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