This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes IsEntityRemovalAllowed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "IsEntityRemovalAllowed" Watch "IsEntityRemovalAllowed" New topic


Yaron Rel

Joined: Aug 04, 2009
Posts: 20
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.

Yaron Rel

Joined: Aug 04, 2009
Posts: 20
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:
I agree. Here's the link:
subject: IsEntityRemovalAllowed
Similar Threads
How to inject EntityManager via setter in spring
EntityManager is null when I try to use it straight from filter servlet
design decision: variation of session fassade
NullPointer with EntityManager in Entity Bean
Database connection using JBoss Seam & JBoss Tools for Eclipse