Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Multiple generated values in one Entity

This is not directly supported.  You could use an event, such as preInsert to
assign the generated value using the Session getNextSequenceNumberValue()
API.  This takes the class however, there does not seem to be an API to get
the next sequence number by name (please log a bug for this).

You may also be able to assign the values on the database, and use
EclipseLink returning support to return the assigned values.

Please log an enhancement request for having support for multiple generated
values in a class.



_es wrote:
> 
> Hi, Is there any way to define more than one field in one Entity to be
> generated with sequence generator that uses Oracle db sequences? If I try
> to define GeneratedValue + SequenceGenerator annotations for more than one
> field in entity EcliseLink throws an exception that states that it is not
> allowed to have two GeneratedValues in one Entity.
> 
> Is there any way to go round that or does anyone have any other idea how I
> could use DB sequences to generate values to columns when Entity is
> inserted?
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
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://old.nabble.com/Multiple-generated-values-in-one-Entity-tp27779151p27837260.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top