database - Hibernate sequence, use the specific sequence -


today db responsible boss told me i'm using wrong sequence, in jpa/hibernate, weren't checked on why generated table entries had higher id normal(trigger) generated entries.
, found this on so horrific me, since use db sequence in db triggers generate entries. means, far know. in 50x time db start hit sequence numbers generated java application.

to avoid this, need use specific sequence, , not sequence*50. havn't found out how this, can me?

thanks in advance

currently defined this:

@id @column(name = "pvp_cost_elements_id") @generatedvalue(strategy = generationtype.sequence, generator = "wtstatseq") @sequencegenerator(name = "wtstatseq", sequencename = "warehouse.wt_stat_seq") 

in hibernate can specify used seq explicitly using annotations

@id @column(name = "column_name", nullable = false) @generatedvalue(strategy = auto, generator = "yourentityseqgen") @sequencegenerator(name = "yourentityseqgen", sequencename = "sequence_name_in_your_database") 

cheers


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -