[jboss-user] [EJB 3.0] - Re: Using EntityManager in a abstract super class
skajotde
do-not-reply at jboss.com
Thu Oct 30 09:47:03 EDT 2008
My team problem like this resolve with inheritance.
public abstract class GeneralDataAccessManipulator implements DataAccessManipulator {
|
| protected abstract EntityManager getEntityManager();
|
| public void delete(Object entity) {
| if (!getEntityManager.contains(entity)) {
| entity = doMerge(entity);
| }
| try {
| doDelete(entity);
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
|
|
| public class Specjalization extedns GeneralDataAccessManipulator {
|
| @PersistenceContext(name="puXXX")
| private EntityManager entityManager;
|
| protected EntityManager getEntityManager() {
| return entityManager;
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4185724#4185724
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4185724
More information about the jboss-user
mailing list