TableHiLoGenerator replacement in Hibernate 5

760 views Asked by At

we are migrating from hibernate 4 to hibernate5. We've used "hilo" generator in our project to generate id to many-to-many tables using a table as seguence generator:

<generator class="hilo">
  <param name="table">cw_unique_key</param>
  <param name="column">next_value</param>
</generator>

but Hibernate 5 does not support hilo and when I use "native" instead of "hilo" the sequesnces start from 0 and not from highest generated number. would you please let me know if there is any replace ment for "hilo" in hibernate 5. thanks

1

There are 1 answers

0
enayat tahvildari On

I've changed the sequence generator from hilo to increment and it worked for me

<generator class="hilo">
    <param name="table">cw_unique_key</param>
    <param name="column">next_value</param>
</generator>

Change sequence generator from hilo to increment

<generator class="increment">
    <param name="table">cw_unique_key</param>
    <param name="column">next_value</param>
</generator>