[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) {
>           this.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.

http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
View this message in context: http://www.nabble.com/Re%3A-Sequence-generator---as-a-service-tp18860557p18870111.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.