[hibernate-dev] remove ID on failed flush
marcel.hoerr at gmx.de
Fri Oct 14 12:10:43 EDT 2011
i'm currently facing the following situation:
we're using the current stable version of hibernate (3.6.7) as a jpa-vendor with an oracle database. the ids of our entities are generated by a sequence, which works fine. but in the case of a failure during the save action, our entities get an id although they have not been saved to the database. in case of a sequence generated id this is quite bad, because we can not use this id again. the id should be set to null.
of course i have read the comments in this ticket:
or the conversations in this thread (and the conversations linked in that thread):
but reading the above articles wasn't quite helpful, because no solution or hint in the right direction was suggested. a few people stated, that this behavior was fixed in hibernate 3, but that seems not be the case.
do you guys have any suggestions how to handle this problem? or is this something application code has to deal with in your opinion (i hope not ;-))?
any help appreciated.
More information about the hibernate-dev