So, I use Hibernate, Spring, PostgreSQL and Quartz.
Quartz my have many concurrent jobs in many threads, so each job insert some data to DB and do it in transaction. Each row have serial attribute, which is getting from DB sequence.
I need a strange thing - all rows, inserted in one job (and, so in one transaction) must going sequentially by numbers from sequence (like, "1,2,3" - to first concurrent transaction and only "4,5,6" to second).
I know, that if we have two or more concurrent transactions - they may get numbers mixed...
How can I solve this?