I'm trying to use JPA to generate IDs from sequences in my database (Oracle 9i)
From what I found here and there, here is the group of annotations I've set on my ID variable :
@Id
@SequenceGenerator(name="PROCEDURENORMALE_SEQ_GEN", sequenceName = "PROCEDURENORMALE_SEQ")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "PROCEDURENORMALE_SEQ_GEN")
@Column(name = "IDPROCEDURENORMALE", unique = true, nullable = false, precision = 10, scale = 0)
private long idProcedureNormale;
However, whenever I create a new object, this id is always set to 0, and because of that I can't persist data. I've tried to change the strategy from GenerationType.SEQUENCE
to GenerationType.AUTO
, nothing changed. For this specific table, Sequence number is supposed to be around 8300.
Where did I go wrong ?