Problems with sequences [message #376351] |
Wed, 16 July 2008 05:41  |
Eclipse User |
|
|
|
Originally posted by: daniel.ortega.gmail.com
Hi there,
All of the primary keys of my entities are set by a sequence created on
the database.
I read the the default allocation-size of JPA is 50 so our sequences are
defined this way on the database:
CREATE SEQUENCE SEQ_ADJUNTO START WITH 1 INCREMENT BY 50;
And the entity:
@Id
@Column(name="ID_ADJUNTO", updatable=false)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "attachment")
@SequenceGenerator(name="attachment", allocationSize=50,
sequenceName="SEQ_ADJUNTO")
private Integer id;
It actually works fine but, when the database is just created, on the
first insert on any table we have this error:
Exception [EclipseLink-7027] (Eclipse Persistence Services - 1.0 (Build
1.0 - 20080707)): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The sequence named [SEQ_ADJUNTO] is setup
incorrectly. Its increment does not match its pre-allocation size.
Just repeating the operation that triggered the insert it works, and all
subsequent inserts too.
Not really a big problem, but we're going into production in a few weeks
and now I think it's time to fix it up.
Any clue of what might be happening?.
Thanks in advance
|
|
|
Re: Problems with sequences [message #376352 is a reply to message #376351] |
Wed, 16 July 2008 06:15  |
Eclipse User |
|
|
|
Originally posted by: daniel.ortega.gmail.com
Forget my question, creating the sequence starting with 50 makes it work
fine. :)
> Hi there,
>
> All of the primary keys of my entities are set by a sequence created on
> the database.
>
> I read the the default allocation-size of JPA is 50 so our sequences are
> defined this way on the database:
>
> CREATE SEQUENCE SEQ_ADJUNTO START WITH 1 INCREMENT BY 50;
>
> And the entity:
>
> @Id
> @Column(name="ID_ADJUNTO", updatable=false)
> @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "attachment")
> @SequenceGenerator(name="attachment", allocationSize=50,
> sequenceName="SEQ_ADJUNTO")
> private Integer id;
>
> It actually works fine but, when the database is just created, on the
> first insert on any table we have this error:
>
> Exception [EclipseLink-7027] (Eclipse Persistence Services - 1.0 (Build
> 1.0 - 20080707)): org.eclipse.persistence.exceptions.ValidationException
> Exception Description: The sequence named [SEQ_ADJUNTO] is setup
> incorrectly. Its increment does not match its pre-allocation size.
>
>
> Just repeating the operation that triggered the insert it works, and all
> subsequent inserts too.
>
> Not really a big problem, but we're going into production in a few weeks
> and now I think it's time to fix it up.
>
> Any clue of what might be happening?.
>
> Thanks in advance
|
|
|
Powered by
FUDForum. Page generated in 0.16352 seconds