Community
Participate
Working Groups
Created attachment 124135 [details] Patch of the changes I made The @SequenceGenerator doesn't do what's expected for DB2: DB2 supports both identity columns and native sequences. But the current implementation doesn't make the difference. For example, the following code should work: @Entity @SequenceGenerator(initialValue=1,sequenceName="ENTREPRISE_SEQ",name="Entreprise_seq",allocationSize=1) public class Entreprise implements Serializable { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="Entreprise_seq") private Integer id; ... } But the current implementation ignores the sequence and assumes an identity column (as explained in the doc/wiki, the sequences are currently not fully implemented for DB other than Oracle). This causes problems of having the id field set to null (expecting the DB will auto-affect the IDENTITY column) instead of already set by the next value of the sequence. I made a patch which works for us and suggest to include it in the next version. (This small patch includes some coherency changes in comments + serialVersionUID, but you can ignore them if you want) I point out that the SQL used in sequence generation I propose is ISO SQL 2003 compliant and could be used on other platform following this standard. I didn't found in the current API the way to specify finer grained properties of sequences other than "increment by". According to ISO SQL 2003, the following additional options should be available: data type, start with, maxvalue, minvalue and cycle.
Setting target to 1.1X so this bug will be a candidate for the first patch release after 1.1
Fixed in main (2.0 stream).
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink