Hello

we have an interface say, DataAccessManipulator. since the method save(), 
delete() and update() are common for all the DAO classes we have created a 
GeneralDataAccessManipulator as an abstract class in which those methods have 
been implemented using EntityManager:


  | public abstract class GeneralDataAccessManipulator implements 
DataAccessManipulator {
  | 
  |     @PersistenceContext
  |     private EntityManager entityManager;
  | 
  |     public void delete(Object entity) {
  |         if (!entityManager.contains(entity)) {
  |             entity = doMerge(entity);
  |         }
  |         try {
  |                     doDelete(entity);
  |             } catch (Exception e) {
  |                     e.printStackTrace();
  |             }
  |         //entityManager.flush();
  |     }
  | 
  | //rest of the code...
  | }
  | 

now this class and many others are located in a jar file namely common-j2ee.jar

because there are many project in the company that are developing at the same 
time we shared this recent jar file for all other projects.

the problem is in our application we have to specify the unitName for the 
PersistenceContext and in another application this name may be different
and because in the GeneralDataAccessManipulator we didn't specify unitName the 
app won't be deployed and of course if we set it, other apps will encounter the 
problem

my question is if we can set that unitName in a way according to the 
applciation persistence unit.

I've read something about @EJBS on class declaration but didn't understand it 
really. Can we make use of that?

I am thinking of giving a specific unitName to the @PersistenceContext defined 
in abstract class an then inject the EM inside my app and set it as the name 
specified above in the SB I am using. Is this possible?



thanks for your help


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184675#4184675

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184675
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to