Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » One entity with two sequences
One entity with two sequences [message #546719] Tue, 13 July 2010 18:33 Go to next message
Mauro Flores is currently offline Mauro Flores
Messages: 83
Registered: September 2009
Location: Brasil
Member
Another issue about migrating a system from openjpa to eclipselink:

For some reason one entity of this system has two columns with values attributed from a sequence:


@Entity
@Table(name = "VGS_SERV_HEMOT")
 class ServHemotED implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ServHemotED_SEQ")
	@SequenceGenerator(name = "ServHemotED_SEQ", sequenceName = "ID_SERV_HEMOT_SEQ", allocationSize = 1)
	@Column(name = "NRO_INT_SERV_HEMOT")
	private Long nroIntServHemot;

	@SequenceGenerator(name="CodVisa_SEQ", sequenceName="ID_COD_VISA_SEQ", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CodVisa_SEQ")
	@Column(name = "COD_VISA")
	private Long codVisa;


The following exception occurs:
Exception [EclipseLink-7169] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.ValidationExcept
ion
Exception Description: Class [class com.procergs.vgs.ed.ServHemotED] has two @GeneratedValues: for fields [VGS_SERV_HEMOT.COD_VISA] and
[VGS_SERV_HEMOT.NRO_INT_SERV_HEMOT]. Only one is allowed.


Correctly or not, openjpa supports this feature. Unfortunately eclipselink doesn't seam to support.

Besides changing the code to set the value of one of the column programmatically, is there another approach?

Thanks, again. Mauro.
Re: One entity with two sequences [message #547147 is a reply to message #546719] Thu, 15 July 2010 12:59 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1844
Registered: July 2009
Senior Member
Please log a bug/enhancement request.

Setting the value yourself is the only solution I can think of.


James : Wiki : Book : Blog
Re: One entity with two sequences [message #548190 is a reply to message #547147] Tue, 20 July 2010 22:38 Go to previous message
Mauro Flores is currently offline Mauro Flores
Messages: 83
Registered: September 2009
Location: Brasil
Member
An enhancement was requested:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=320456
Previous Topic:help with moving to JPA
Next Topic:Obtaining EM properties outside a transaction
Goto Forum:
  


Current Time: Fri May 24 01:35:32 EDT 2013

Powered by FUDForum. Page generated in 0.01473 seconds