  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | - EntityQuery.refresh() doesn 't clear the result list? | - EntityQuery.refresh() doesn 't clear the result list? 2007-07-18 - By ASavitsky
Back Not sure whether it's a bug, or just me, but it doesn't look like the refresh() method is doing anything for me - the result list is stale and never refreshes, until I start a new coversation...
I have a simple CRUD screen where the edit form is combined with the record listing: <h:form id="listForm" styleClass="form"> | <ui:repeat var="transaction" value="#{userTransactions.resultList}"> | <h:commandLink action="#{transactionController.select(transaction)}" value="#{transaction.account.accountNumber} " /> | </ui:repeat> | <h:commandButton action="#{transactionController.create}" value="Add New" /> | </h:form> | <h:form id="rowForm" styleClass="form" rendered="#{not empty selectedTransaction}"> | <!-- form fields go here --> | <h:commandButton action="#{transactionController.save}" value="Save" /> | <h:commandButton action="#{transactionController.remove}" value="Remove" immediate="true" rendered="#{not selectedTransaction.new}" /> | <h:commandButton action="#{transactionController.cancel}" value="Close" immediate="true" /> | </h:form> The query for record listing is an EntityQuery defined in components.xml: <framework:entity-query name="userTransactions" scope="conversation" order= "transactionDate, securityName"> | <framework:ejbql> | FROM Transaction | WHERE user = #{principal} | </framework:ejbql> | </framework:entity-query> and the controller code has the EntityQuery injected, and refreshes the list as necessary: @(protected) ("transactionController") | @(protected) (ScopeType.CONVERSATION) | public class TransactionController extends BaseController { | @(protected) (required = false) | private Transaction selectedTransaction; | @(protected) EntityQuery userTransactions; | | public void cancel() { | selectedTransaction = null; | } | public void create() { | selectedTransaction = new Transaction(); | } | @(protected) | public void remove() { | em.remove(selectedTransaction); | em.flush(); | selectedTransaction = null;userTransactions.refresh(); | } | @(protected) | public void save() { | em.persist(selectedTransaction); | em.flush(); | selectedTransaction = null;userTransactions.refresh(); | } | public void select(Transaction transaction) { | selectedTransaction = transaction; | } | } The whole thing runs in a long conversation, started when the page is entered: <page view-id="/attestation/transactions.xhtml"> | <begin-conversation flush-mode="manual" join="true" /> | </page>
Now, any time a new record is inserted, or an old one removed, the list should refresh, shouldn't it? It doesn't, and I'm running out of any ideas on to why would this happen... Help, anyone?
Thanks,
Alex
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic &p=4065436#4065436
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode =reply&p=4065436 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ jboss-user mailing list jboss-user@(protected) https://lists.jboss.org/mailman/listinfo/jboss-user
|
|
 |