|
Hello all, I'm having a small problem with my value objects for CMP entity beans. I want to create value objects in such a way that the complete underlying entity bean graph (if the entity has CMR with other entity beans, etc) is replicated and represented as a value object. However, I am getting some "entity bean re-entrant" exceptions when I try to access them. Below I'll give a section of my source code: CollegeBean.java (main part) public abstract class CollegeBean implements EntityBean { protected EntityContext ctx; public CollegeBean() {} // -------------- BEGIN GET/SET METHODS -------------- public abstract Integer getCollegeId(); public abstract void setCollegeId(Integer id); public abstract String getCollegeName(); public abstract void setCollegeName(String name); public abstract Collection getDepartments(); public abstract void setDepartments(Collection departments); public CollegeVO getCollegeVO() { CollegeVO college = new CollegeVO(getCollegeId()); Collection departments = new ArrayList(); Iterator i; college.setCollegeName(getCollegeName()); for (i = getDepartments().iterator(); i.hasNext(); ) { DepartmentLocal department = (DepartmentLocal) i.next(); departments.add(department.getDepartmentVO()); } college.setDepartments(departments); return college; }
CollegeVO.java public class CollegeVO implements java.io.Serializable { private Integer collegeId; private String collegeName; private Collection departments; public CollegeVO(Integer collegeId) { this.collegeId = collegeId; } public CollegeVO() { } public Integer getCollegeId() { return collegeId; } public void setCollegeId(Integer collegeId) { this.collegeId = collegeId; } public String getCollegeName() { return collegeName; } public void setCollegeName(String name) { this.collegeName = name; } public Collection getDepartments() { return departments; } public void setDepartments(Collection departments) { this.departments = departments; } } And here is an exception that I'm getting from BEA WebLogic 7.0. Note that all of my session/entity beans have their transaction attribute set to Required for all the methods. javax.ejb.TransactionRolledbackLocalException: EJB Exception: ; nested exception is: javax.ejb.TransactionRolledbackLocalException: EJB Exception: ; nested exce ption is: javax.ejb.TransactionRolledbackLocalException: EJB Exception: ; nested exception is: javax.ejb.TransactionRolledbackLocalException: Illegal Reentrant call to College with primary key: 18: weblogic.ejb20.InternalException: Illegal Reentrant call to College with primary key: 18 at weblogic.ejb20.manager.BaseEntityManager.checkForReentrant(BaseEntity Manager.java:384) at weblogic.ejb20.manager.DBManager.preInvoke(DBManager.java:233) at weblogic.ejb20.internal.BaseEJBLocalObject.preInvoke(BaseEJBLocalObje ct.java:125) Etc.. etc... Am I producing the representation of the value object correctly in the getCollegeVO() method of the CollegeBean? Any suggestions are highly appreciated! Best regards, Ryan LeCompte [EMAIL PROTECTED] |
- Re: Problem with value objects Ryan LeCompte
- Re: Problem with value objects Ryan LeCompte
- Re: Problem with value objects Juan Pablo Lorandi
- Re: Problem with value objects Juan Pablo Lorandi
