We are using jboss-seam-2.0 for our application development and application code is
generated. All the entities are accessing the same entity manager and thus same data
source.
But I have to access a different data source for populating some information in a drop
down. So I have one session bean which has an entity manager configured to access that
data source.
| @Stateless
| @Name("csagent")
| @Scope(ScopeType.SESSION)
| public class CSAgentHelper implements CSAgent {
|
| @PersistenceContext(unitName = "misEntityManager")
| private EntityManager em;
| private CSAgentProfile csagentProfile;
|
| public CSAgentProfile getCsagentProfile() {
| if (csagentProfile == null) {
| csagentProfile = new CSAgentProfile();
| csagentProfile.setEmpStatusList(loadEmpStatusList());
| }
| return csagentProfile;
| }
|
| private List<EmpStatus> loadEmpStatusList() {
| List resultList = null;
| List empStatusList = new ArrayList();
| Query query = em.createQuery(
| "select empStatus from EmpStatus empStatus where empStatus.activeFlag =
'Y'");
| resultList = query.getResultList();
| if (resultList != null) {
| SelectItem selItem = null;
| EmpStatus empStatus = null;
| for (int i = 0; i < resultList.size(); i++) {
| empStatus = (EmpStatus) resultList.get(i);
| selItem = new SelectItem(empStatus.getEmpStatusId(),
empStatus.getEmpStatusName());
| empStatusList.add(selItem);
| }
| }
| return empStatusList;
| }
| }
|
Entity manager for the entity beans is configured like..
| @Entity
| @Table(name = "AWARD")
| @PersistenceContext(unitName = "empmstEntityManager")
| @SequenceGenerator(name="SEQ_STORE", sequenceName="AGENTS_SEQ")
| public class Award implements java.io.Serializable {
| -----------
| -----------
| }
|
There is no issue with the deployment of entities. But when the session bean is deployed,
I get an error like..
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:ear=empmst.ear,jar=empmst.jar,name=CSAgentHelper,service=EJB3
State: NOTYETINSTALLED
I Depend On:
persistence.units:unitName=misEntityManager
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: persistence.units:unitName=misEntityManager
State: NOTYETINSTALLED
Depends On Me:
jboss.j2ee:ear=empmst.ear,jar=empmst.jar,name=CSAgentHelper,service=EJB3
Looks like it is a problem with the deployment order. When the session bean is deployed,
it looks for entity manager which is not deployed yet.
can anyone pls. help me fix this issue?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066258#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...