Pages

Friday, November 16, 2012

hibernate ondelete cascase for generic collection

Well if your are doing a @OnDelete(action=OnDeleteAction.CASCADE) for a generic collection like a list of strings etc... then chances are that hibernate will raise an exception. It cannot initialize the sessionfactory bean. This at the moment, is a bug in hibernate. The easiest method is to clear the collection and saving first, then deleting the entity.
How ever most of the time, if you are doing a bulk deletion using hibernate, then chances are that you are on your own. You will have to handle them rather than expecting hibernate to handle everything with a single annotation.

No comments:

Post a Comment