We have a table in which data is inserted from two different sources with their own primary key generation techniques. So, there is a strong possibility that primary key conflict happens. We want to make one of the sources to create negative primary keys using hibernate to prevent such conflict. Is it possible? and How? Thank you in advance
If you want to create a generation with negative number here is a way in your database
create sequence SEQ_ACE_WORKERS
MINVALUE -100
MAXVALUE 1
START WITH -99
INCREMENT BY 1
;
And in your hibernate class you change the strategy to "sequence". But i think to go further that you should really use the same sequence for the two sources
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.