I'm using TableGenerator to generate Ids.
This is my configuration:
Code:
<id
name="id"
column="id"
type="java.lang.Integer"
unsaved-value="null">
<generator class="net.sf.hibernate.id.TableGenerator">
<param name="table">app_primary_key</param>
<param name="column">next_id</param>
</generator>
</id>
When I save a new record everything works fine. The new record gets the correct id and the key table (app_primary_key) updates the value.
But If the new record have a constraint error (for example duplicate value on a unique field) the key table is updated although the new record is not saved.
I prefer that if the record is not saved the key table manteins the same value, is this possible?
Thanks, Claudio. (apologize for my english)