Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.5
Mapping documents:
Code between sessionFactory.openSession() and session.close():
private void removeList(List list) {
Session session = sessionFactory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
if (list == null) {
return;
}
Iterator iter = list.iterator();
while (iter.hasNext()) {
session.delete(iter.next());
iter.remove();
}
tx.commit();
} catch (RuntimeException ex) {
if (tx != null) {
tx.rollback();
}
throw ex;
} finally {
session.close();
}
}
Full stack trace of any exception that occurs:
Name and version of the database you are using: oracle 10g
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I have a list of sites, each with many other associations to other hibernate objects. I don't have any cascades at the database level (NO foreign keys with "ON DELETE CASCADE"), and I do have "all-delete-orphan" at many associations (not all, but most), because the site is one of the central objects in my model. I want to clear the database at this test I am running, right before filling it up again with random new data. When I try to run the previous method my site list, I get the above-mentioned NonUniqueObjectValue exception. I thought that maybe some cascading option I have in the xml was causing the site to somehow delete itself, or delete a following site, but I have no such cascading - no other object in the database has "all-delete-orphan" on the site object. I also changed several of the site's cascading associations to just "save-update", but I Still haven't found which association causes this trouble.
Where can I look for a solution for this problem? What might have caused it?
Thank you.