users@glassfish.java.net

Re: JPA: how to configure default sequencer?

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Thu, 22 Mar 2007 15:37:41 -0700

Hi Witold,

Bad news: the spec allows (unfortunately IMHO) to treat GenerationType.AUTO in
any way a provider wants and TopLink Essentials uses table-based generation for
this setting.

Good news: You should be able to override the @GeneratedValue annotation using
orm.xml's that use partial overrides.

Regards,
-marina

Witold Szczerba wrote:
> Hello there,
> is there some way to tell JPA provider which sequencer should be taken
> by default when generating identity fields?
>
> Here is an example of my @Entity class:
>
> @Entity
> public class Loan {
>
> @Id
> @GeneratedValue(strategy = GenerationType.AUTO)
> private Long id;
>
> @Version
> private long version;
>
> ...........
> ...........
> }
>
> In my company, we use Hibernate for importing large amount of data,
> because TopLink Essentials has memory leaks (tested on Glassfish 9.0)
> which eventually causes JVM to throw OutOfmemoryException. I know, we
> should try Glassfish 9.1, but both GF9.1 and NetBeans 5.5.1 are still
> in beta.
>
> The problem is that Hibernate and TopLink are using different default
> sequencers in our database (this is Oracle XE). When import (it is
> performed by separate EJB module) is done, when we start using our
> application core module, TopLink is creating new entities using
> different sequencer.
>
> I am worrying that we will have to re-factor every @Entity's
> @GeneratedValue annotation (we have many, many....many entities)
> setting explicitly the sequencer name, but I would like to know if
> there is some other way, so by default Hibernate and Toplink would use
> exactly the same sequencer for every @Entity...
>
> Thanks in advance,
> W.Sz.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>