Hibernate version: JBoss 4.0.2
Name and version of the database you are using:Microsoft SQLServer
I am trying to delete a class that has a Set of mappings to its super class:
Group extends Principal.
Principal has a set of Groups (Set<Group> groupMappings)
Group has a set of Principals (Set<Principal> principalMappings)
This allows me to get every member of a group and find out from a group member what groups he is a member of.
When deleting a Group that has a set of child groups I am getting an ObjectDeletedException.
The class PrincipalGroup that maps a Principal to a Group has the group side of the mapping set to lazy=true. All other mappings are lazy=false.
I have tried changing these settings, but this has made no difference.
My code for deleting the Group is as follows:
Code:
public void deleteGroup(String realm, String group) throws SecurityDomainException
{
//Open session
Session session = sessionFactory.openSession();
//Get realm and group
Realm r = DomainFacade.getInstance(session).getRealm(realm);
Group g = DomainFacade.getInstance(session).getGroup(r, group);
//Delete it.
DomainFacade.getInstance(session).delete(g);
//Close session
session.close();
}
DomainFacade is a singleton and the getInstance sets the session.
The code for delete in DomainFacade is as follows:
Code:
public void delete(Object o)
{
//Begin transaction
Transaction transaction = session.beginTransaction();
//Delete
session.delete(o);
//Commit transaction
transaction.commit();
}
Does anyone have any ideas, or has anyone else experienced this same problem?
Any help will be much apprecieated.