EntityQuery.resultList contains all nulls after AJAX request
asavitsky Nov 7, 2007 3:29 PMThis one drives me crazy! If there's a list box backed by an EntityQuery, on the same page with an AJAX component (in my case it's RichFaces DataScroller/DataTable), then after several AJAX requests, the resultList for EntityQuery contains a list of nulls. It looks like every entity in the resultList is replaced with a null. I'm not sure whether it's Seam or RichFaces, but it's bound to be one or the other.
Anyway, here's the setup: Seam 2 GA, RichFaces 3.1.2, Facelets 1.1.14, JSF RI 1.2.05, Hibernate 3.2.5 GA.
The entites A and B are identical in structure (though they can be different, for as much as this bug cares):
@Entity public class A implements Serializable { @Id private String name; public String getName() { return name; } }
The EntityQuery's:
<core:init debug="false" /> <core:manager conversation-timeout="120000" concurrent-request-timeout="500" /> <persistence:entity-manager-factory name="testDatabase" /> <persistence:managed-persistence-context name="entityManager" entity-manager-factory="#{testDatabase}" auto-create="true" /> <transaction:entity-transaction entity-manager="#{entityManager}" /> <framework:entity-query name="listOfA" scope="conversation" ejbql="FROM A a" order="name" /> <framework:entity-query name="listOfB" scope="conversation" ejbql="FROM B b" order="name" /> <security:identity authenticate-method="#{authenticator.authenticate}" /> <web:ajax4jsf-filter force-parser="false" enable-cache="true" class="org.ajax4jsf.FastFilter" />
Now, the Facelets page:
<h:form xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:r="http://richfaces.org/rich"> <r:dataTable id="list" var="a" value="#{listOfA.resultList}" rows="4"> <r:column> <h:commandLink action="Dummy" value="#{a.name}" /> </r:column> </r:dataTable> <r:datascroller align="left" maxPages="1" for="list" fastControls="auto" /> <br /> <h:selectOneMenu value="#{notImportantHere}"> <s:selectItems value="#{listOfB.resultList}" var="b" label="#{b.name}" noSelectionLabel="Select one..." /> <s:convertEntity /> </h:selectOneMenu> </h:form>
Pretty simple - there's a scrollable datatable for entity A, and a dropdown for entity B. Now, when user activates the datascroller twice, and then selects an A from the data table, the list of Bs is empty - it contains the same # of entries as before, but they are all empty.
Has anyone ever encountered such behavior before? Is this a bug? I myself have seen it before, with a different AJAX component (it was a RichFaces suggestion box that time), but dismissed it on the notion that "what else could you expect from a beta" (Seam was B2 at the time)?
Thanks in advance,
Alex