Aha!

  | java.lang.IllegalStateException: A CMR collection may only be used within the 
transction in which it was created
  |     
org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet.getIdList(RelationSet.java:66)
  |     
org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet.access$000(RelationSet.java:32)
  |     
org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet$1.<init>(RelationSet.java:355)
  |     
org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet.iterator(RelationSet.java:353)
  |     
org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(Unknown 
Source)
  |     
org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(Unknown
 Source)
  |     org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(Unknown 
Source)
  |     javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(Unknown Source)
  |     org.apache.jsp.displayItem_jsp._jspx_meth_c_forEach_0(displayItem_jsp.java:28

>From what you say in your original post and from this stack trace, I think what you 
>are doing is:

jsp calls session bean
===Tx Starts===
Session Bean calls Entity.findByPK()
SessionBean returns entity
===TX ends====
jsp tries to iterate over the CMR collection of the entity bean (and is not in the Tx.


The usage pattern for what you are trying to achieve is

jsp calls session bean
===Tx Starts===
Session Bean calls Entity.findByPK()
SessionBean iterates over  CMR Collection and populates DTO object
Session Bean returns DTO
===TX ends====
jsp uses DTO

The DTO is just for holding data to be passed across the layers, and knows nothing 
about ejb's


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3848583#3848583

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3848583


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to