|
Check
out section 10.5.11 of the EJB 2.0 spec. Basically, if you mark the bean as not
reentrant, the container throws that exception to prevent transactional diamonds
from ocurring; and yes, marking them as reentrant may yield unpredictable
results if a client executes concurrent calls to the same entity reference;
depending on the commit option this is more or less likely to happen. My
clients always are JSP/Servlets, thus I would have to go out of my way to write
code that executed a method on the same stub concurrently.
Also,
after looking carefully at the code (again), I can't seem to find precisely
where the reentrant calls are being done. I suspect it is on the getCollegeVO
method, and it's triggered by calling the abstract methods(yuck, that shouldn't
happen at all). To solve this, just modify the VO class addind a new static
method, getInstance() :
public
static CollegeVO getInstance(Integer collegeId)
throws ObjectNotFoundException
{
CollegeVO rval = new
CollegeVO(collegeId);
//
JNDI code removed for clarity
College c =
collegeHome.findByPrimaryKey(collegeId);
Collection departments = new ArrayList();
Iterator i;
rval.setCollegeName(getCollegeName()); for (i = getDepartments().iterator(); i.hasNext(); ) { DepartmentLocal department = (DepartmentLocal)
i.next();
departments.add(department.getDepartmentVO());
}
rval.setDepartments(departments); return rval; } Just a
rough draft, I'm sure you could improve by using Local interfaces, IIOP
complaint narrows, and more error checking.
HTH,
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.
|
Title: Message
- 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
