We are using MVCSoft-pm to support inter-bean relationships. This means that referential-integrity is automatically enforced, which is good. However, I am wondering how one can put constraints on a relationship. Since the cmr accessor-methods need to be abstract one cannot enforce any constraints here.
For instance: bean A has a reference to bean B. Bean B is removed but the relationship to bean B is required for bean A, so bean B need to stop the removal of bean A. The solutions I could think of are:
Use DB-constraints. This solutions results in an EJBException being thrown leaving the application unable to determine the exact nature of the problem. Plus more complex constraints cannot be implemented.
Enforce this constraint in bean B. This leads to decentralized logic.
Enforce the constraints in the ejbStore of the bean. This means that the check is executed on every invocations of ejbStore, which can have a negative impact on performance.
Are there better solutions for this problem?