I am trying to save an object with an attribute that I want to populate from a database sequence. I use Oracle, created a sequence, checked the sequence through sql, and yet my attribute is not populated. Here is what I have:
@GeneratedValue(generator = "RFQ_LINE_IDS_SEQUENCE", strategy=GenerationType.SEQUENCE)
@SequenceGenerator(name="RFQ_LINE_IDS_SEQUENCE", sequenceName="RFQ_LINE_IDS_SEQUENCE", allocationSize=1000000000)
@Column(name = "external_line_item_id")
private String externalLineItemId;
All the examples that I see on the Internet show this annotation used with @Id, but I have another attribute that I use for my id.
I also tried the following to no avail:
@GeneratedValue(generator = "RFQ_LINE_IDS_SEQUENCE", strategy=GenerationType.SEQUENCE)
@GenericGenerator(name = "RFQ_LINE_IDS_SEQUENCE", strategy = "sequence",
parameters = {@Parameter(name = "sequence", value = "RFQ_LINE_IDS_SEQUENCE")})
@Column(name = "external_line_item_id")
private String externalLineItemId;
source
share