i using hibernate annotations. want make column autoincremented. have created sequence in database(oracle) , mapped sequence in java pojo class. need create trigger sequence too? want know how can make column autoincremented while using hibernate anotation? changes have in java , database side? please me in this. following part of code have mapped sequence.
public class simruns implements serializable { private static final long serialversionuid = 8698324570356602407l; @id @column(name = "run_id") @generatedvalue(strategy=generationtype.sequence, generator="seq_run_id") @sequencegenerator(name="seq_run_id", sequencename="seq_run_id") private long runid; }
this works me:
@id @generatedvalue(generator = "nosicseq") @sequencegenerator(name = "nosicseq", sequencename = "nosic_seq", allocationsize = 1) @column(name = "sid") private bigdecimal sid; no triggers in db needed, sequence.
Comments
Post a Comment