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: Tue, 04 Aug 2009 18:01:33 -0700

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.