I am writing a java application which reads excel file and puts all rows as records into database table. for primary key generation,I want to use sequencegenrator with existing sequence in database.using this https://www.logicbig.com/tutorials/java-ee-tutorial/jpa/seq-generator.html as reference.
let's say I have 100k rows in excel and I am reading one by one row and creating java object out of it.using sequence genrator I set initial value as the next value of database sequence and allocation size as 100k. for ex. sequence next value is 200.then initial value would be 201 and allocation size would be 100201.
Que : I start the application to insert all records.what if someone from UI inserts a new record into the table.sequence next value will be used but if id is already is used, will I get any exception for duplicate key in my java application or how can I handle this situation?