ORA-02289: sequence does not exist, error in hibernbate
12,165
Solution 1
In Oracle you can't autogenerate values, you should create a sequence (let's call it VEHICLE_SEQ). Then you should put this annotations on your id:
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ")
@SequenceGenerator(name = "SEQ", sequenceName = "VEHICLE_SEQ")
To create the sequence:
CREATE SEQUENCE VEHICLE_SEQ START WITH 1 INCREMENT BY 1;
Solution 2
You can use as below, if you are not really focussing only on sequence number to generate the ID
@Column(name = "XYZ", nullable = false)
@GeneratedValue(generator = "uuid.hex")
@GenericGenerator(name = "uuid.hex", strategy = "uuid.hex")
@Id
This generates the new number whenever a new records gets inserted
Related videos on Youtube
Author by
Admin
Updated on September 15, 2022Comments
-
Admin over 1 year
ORA-02289: sequence does not exist, error in hibernbate