java - Auto Increment in hibernate using oracle -
i new hibernate , want insert primary number in table unique identification. using oracle database need create sequence in oracle auto increment generation number ?
i using below code not working. have not created sequence yet.
@id @column(name = "id" ) @generatedvalue ( strategy = generationtype.table)
i have used auto
, sequence
, identity
nothing works me.
this 1 way of using oracle sequence in jpa mapped entity:
@id @column(name = "id") @generatedvalue(strategy = generationtype.sequence, generator = "sequence_name") @sequencegenerator(name = "sequence_name", sequencename = "sequence_name", allocationsize = 1, initialvalue = 1)
in way persist() method ask next value of sequence in order use id entry.
Comments
Post a Comment