Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] Question on sequencing using TableGenerator

Thanks a lot Andrei and Reinhard.

 

I asked the query below in order to understand the logic eclipselink handles sequence generation. I am planning to introduce our own sequence generator since we need IDs to be generated upfront before an entity is attached to the em.

 

I have an option to do this using spring jdbc. However being new to Spring JDBC I am unable to think of a similar implementation using Spring JDBC template wherein I can update preceding select and execute them both in the same transaction.

 

Can somebody please throw some light?

 

Regards,

Shashi

 

From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Andrei Ilitchev
Sent: Tuesday, July 20, 2010 11:24 PM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] Question on sequencing using TableGenerator

 

In table sequence case, update precedes select and both are executed in the same transaction - so no dirty reads can happen.

On 20/07/2010 12:49 PM, Shashikant Kale wrote:

Hi,

 

We have been using eclipselink and I have a question wrt eclipselink in clustered environment. We are using TableGenerator for generating primary keys and we use the same sequence for all the entities.

 

e.g.

 

      @GeneratedValue(strategy = GenerationType.TABLE, generator = "default")

      @TableGenerator(

            name = "default",

            table = "ID_GENERATOR",

            pkColumnName = "ID_NAME",

            valueColumnName = "ID_VALUE",

            pkColumnValue = "default",

            initialValue = 1,

            allocationSize = 50

      )

 

However I have found that the Select query is fired without “For Update” clause. Wouldn’t this cause issues due to dirty reads across multiple JVMs?

 

Kindly let me know how this is taken care.

 

Thanks,

Shashi

 


 
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
  

Back to the top