Details
Description
I am trying to create a Custom (generic, user) Sequence Generator following the instructions from Patrick Linskey:
@Id
@Column(name = "Data_Object_Id", nullable = false)
@SequenceGenerator(name="DataObjectsSeq", sequenceName="test.DataObjectsGenerator")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="DataObjectsSeq")
private BigDecimal dataObjectId;
Unfortunately this doesn't works in my case maybe because I am using database which in principle doesn't support sequences or another reason. I dig up the code and see that there is incorrectly logic in class ImplHelper.java:
private static Object generateValue(StoreContext ctx, ClassMetaData meta, FieldMetaData fmd, int typeCode)\
{
...
switch (strategy)
}
In my opinion the problem is that when I am creating a custom sequence, in switch statement this custom sequence is treat as native database sequence. This is a general problem. The correct behavior in this sequence to be treat as custom sequences as UUID_STRING and UUID_HEX. To be fixed that problem I will create a new enumeration which will be named CUSTOM or GENERIC or another name. Then I will do the relevant changes in the code. Then in the switch statement will be with one more case as follow:
switch (strategy)
Attachments
Issue Links
- duplicates
-
OPENJPA-470 Custom sequences specified via @SequenceGenerator must have parentheses at the end of the class name
- Closed