Title: Message
 
Thanks for responding. However, if the CMP entity beans are reentrant, that means that multiple threads can be accessing the entity  bean at a given moment. If I have the transaction attribute set to Required for all methods of all the CMP entity beans, is it still possible for data to get corrupted if the beans are True for reentrant?
 
Ryan
 
-----Original Message-----
From: Juan Pablo Lorandi <[EMAIL PROTECTED]>
To: 'Ryan LeCompte' <[EMAIL PROTECTED]>
Date: Saturday, October 12, 2002 8:46 AM
Subject: RE: Problem with value objects

Try marking the entity bean as reentrant. Reentrant should be the default, esp. for CMP beans.
 
Juan Pablo Lorandi
Chief Software Architect
Code Foundry Ltd.

Barberstown, Straffan, Co. Kildare, Ireland.
Tel: +353-1-6012050  Fax: +353-1-6012051
Mobile: +353-86-2157900
www.codefoundry.com
 
Disclaimer:
 
Opinions expressed are entirely personal and bear no relevance to opinions held by my employer.
Code Foundry Ltd.'s opinion is that I should get back to work.
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]] On Behalf Of Ryan LeCompte
Sent: Saturday, October 12, 2002 5:14 AM
To: [EMAIL PROTECTED]
Subject: Problem with value objects

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]

Reply via email to