One entity with two sequences [message #546719] |
Tue, 13 July 2010 22:33 |
Mauro Flores Messages: 84 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.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01490 seconds