suppose there are two EntityBean A and B with one-one relationship. If A is deleted, B also should be delete.
There is a mothodA() in SessionBean.
public void methodA() throws Exception{
......
A a = home.findByPrimaryKey(aId);
B b = a.getB();
b.remove();
//... do something others
// (1)
a.remove();
}
The session bean is stateless, and methodA's transaction attribute is 'Required'.
According to the session facade
pattern, I consider that there should be only one transaction in methodA, so if the exception is thrown, transaction should be rolled back. Both a and b should be still in DB.
But now in fact, b is deleted, a is still in DB. I don'w know what's wrong with my configuration.