I am trying to find a way to know if a removal of an entity is allowed.
is there any simple way to do that?
The method signature:
I have 2 Stateless session bean that I can use each of them:
1. CMT bean with injected entity manager.
2. BMT bean with entity manager that is being created by entity manager factory.
posted 5 years ago
I found some ways to know if I am allowed to remove an entity.
The entity removal can be disallowed due to constraints on the DB record that represent the entity to be removed.
I must admit that I don't love this ways because I rely on condition of exceptions, but this is what I got.
Here are 3 ways: