Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Sequence generator - as a service

So my understanding is that you want to assign the sequence numbers to your
objects yourself, outside of the transaction where the objects are

You can do this in EclipseLink using the EclipseLink Session API
getNextSequenceNumberValue(Class).  You will need to cast your JPA
EntityManager to get the EclipseLink Session from it.

Jan Vissers wrote:
> Let me try and clarify.
> Basically I want to have an entity, say
>   @Entity
>   public class Master implements Serializable {
>       @Id
>       private long id;
>       public void setId(long id) {
>  = id;
>       }
>   }
> For which the primary key will be created separately - in the most
> efficient way (like EclipseLink which caches a number of unique numbers
> from a sequence) - in order to set it later. The creation of the key value
> and the actual storage of the Master are not within the same persistency
> context.
> -J.

--- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top