users@glassfish.java.net

Re: I am using JPA and I am using _at_GeneratedValue(strategy = GenerationType.AUTO) but it does not increment correctly

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Wed, 05 Aug 2009 12:49:35 -0700

You can override the default by specifying allocationSize. You will need
to specify a TableGenerator for it. However, please note that reducing
allocationSize would increase database round trips to select and update
the sequence table. Here is a similar discussion on this topic on
EclipseLink forums
http://www.nabble.com/Ids-not-being-used-tp24644801p24644801.html

Sarah kho wrote:
> Hi, yes brought down the application.
> Is there anyway to disable the cache?
> Thanks
>
> On Wed, Aug 5, 2009 at 5:31 AM, Mitesh Meswani <Mitesh.Meswani_at_sun.com
> <mailto:Mitesh.Meswani_at_sun.com>> wrote:
>
> Sarah kho wrote:
>
> Hi
> Thank you for reading my post.
> I am using JPA and I am using the follwing notation for my key
> field.
> @Id
> @GeneratedValue(strategy = GenerationType.AUTO)
> private Long id;
>
> problem is that records in the database do not have correctly
> sequenced ID values. for exaple the first record is 3 and the
> second record is 53, is there any way that I can fix it?
>
> Did you bring down the application between two runs? Toplink
> Esseentials by default caches 50 ids at a time.
>
> -Mitesh
>
> My database is MySQL and I am using Toplink Essential.
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> <mailto:users-help_at_glassfish.dev.java.net>
>
>