[jboss-user] [JBoss Seam] - Lazy loading problem

xtia004 do-not-reply at jboss.com
Sun Jan 21 17:32:53 EST 2007

I have an SFSB with name "invoiceListAction" in session scope. An entity manager with extended persistence context type is injected. When within a dataTable, I use following code to call a method of invoiceListAction. The lazy loading works well.

  |             <s:link styleClass="link_font" action="#{invoiceListAction.exportToPdf}">
  |               <t:graphicImage url="/media/pdf-icon.gif" />
  |             </s:link>
The method "exportToPdf" calls anthor method "getSelectedInvoice" that annotated by @DataModelSelection at invoiceListAction to get an invoice instance. The address property of agency is in lazy fetch type.

But if not within a dataTable, I used two ways to access the lazy loaded property, exception raised as "failed to lazily initialize a collection of role".
One way is using exactly the same code as above. And the other way is as below:

  | <c:set var="add" value="#{invoiceListAction.selectedInvoice.agency.primaryAddress}" scope="page" />

Could anybody help me for this?

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

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

More information about the jboss-user mailing list