[JBoss Seam] - Lazy loading problem
by xtia004
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
19 years, 3 months
[EJB 3.0] - Oracle problems mapping to CHAR(1) column
by tvrtko
I have a database column PARTNER_TYPE of type CHAR(1). The relevant part of entity class looks like this:
private String partnerType;
|
| @Column(name = "PARTNER_TYPE", length=1)
| //@Length(max = 1)
| public String getPartnerType() {
| return partnerType;
| }
When I run the program I get the following exception:
org.hibernate.HibernateException: Wrong column type: PARTNER_TYPE, expected: varchar2(1 char)
Then I tried:
@Column(name = "PARTNER_TYPE", length=1, columnDefinition = "CHAR(1)")
and I got
org.hibernate.HibernateException: Wrong column type: PARTNER_TYPE, expected: CHAR(1)
Then I tried:
@Column(name = "PARTNER_TYPE", length=1, columnDefinition = "CHAR")
and I got
org.hibernate.HibernateException: Wrong column type: PARTNER_TYPE, expected: CHAR
Any idea?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004638#4004638
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004638
19 years, 3 months