OBJECTS ARE INVOLVED IN THIS ERROR CONDITION:
The scope of my problem boils down to one JSP Tag class and two entity beans. The
two entity beans share a many-to-many relationship. This relationship is identical
to the classic Student-Teacher examples found in many tutorials -- i.e. a Student
has many Teachers; a Teacher has many Students -- so I'll provide similar examples
below, rather than get bogged down with my business domain.
CONFIGURATION OF MY ENTITY BEANS:
1) ejb-jar.xml:<trans-attribute> = “Supports” for both entity beans
2) eblogic-ejb-jar.xml:<concurrency-strategy> = “Database” for both entity beans
WHAT STEPS LEAD UP TO THE ERROR?
My JSP tag (i.e. “forEach”) retrieves one of the beans (e.g. “Student”) via a Delegate
and a Façade Session object. It successfully retrieves the cmr collection (e.g.
“getTeachers()”). As soon as I try to iterate over the collection (i.e. the point
at which WebLogic actually accesses the database), I get the exception.
WHAT DID I EXPERIMENT WITH TO TRY TO AVOID THE EXCEPTION:
I experimented with several temporary changes, and none of them worked. These include:
1) Changed <concurrency-strategy> to “ReadOnly” for both entity beans
2) Changed <trans-attribute> to “NotSupported” for both entity beans.
3) I even changed <trans-attribute> to all other txn types just to see what would
happen. Except for “Mandatory” (which triggers the TransactionRequiredException),
I continued to get the same exception regardless of the <trans-attribute> setting.
(I thought that “Required” and higher would at least work.)
4) For comparison purposes, I also experimented with all of the above configuration
changes on a simple cmp-field accessor method (e.g. getStudentName). When I access
a cmp-field from my tag, everything seems to work correctly.
IN SUMMARY...
I am puzzled as to why I cannot access a cmr-field outside the scope of a transaction.
Any guidance will be greatly appreciated at this point.
Thanks,
Jim
This is a common mistake. You're not supposed to accessed a relationship
field remotely according to the spec. WLS lets you do that though, but under
one condition: that the transaction HAS to be demarcated on the client side
(surrounding the Collection being accessed).
Moreover, you have to use transaction attribute Required, RequiresNew or
Mandatory according to the spec (EJB2final, 17.4.1, p352). In other words
you have to have a transaction.
I don't recommend accessing relationships remotely; it's too slow. Wrap
everything in an EAR file and access your entity beans locally.
Emmanuel
"Jim Whalen" <James....@trustvesta.com> wrote in message
news:3cc830fd$1...@newsgroups2.bea.com...