[jboss-user] [JBoss Seam] - EntityQuery.refresh() doesn't clear the result list??

ASavitsky do-not-reply at jboss.com
Wed Jul 18 11:29:07 EDT 2007


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:
@Name ("transactionController")
  | @Scope (ScopeType.CONVERSATION)
  | public class TransactionController extends BaseController {
  | 	@Out (required = false)
  | 	private Transaction selectedTransaction;
  | 	@Inprivate EntityQuery userTransactions;
  | 
  | 	public void cancel() {
  | 		selectedTransaction = null;
  | 	}
  | 	public void create() {
  | 		selectedTransaction = new Transaction();
  | 	}
  | 	@Transactional
  | 	public void remove() {
  | 		em.remove(selectedTransaction);
  | 		em.flush();
  | 		selectedTransaction = null;userTransactions.refresh();
  | 	}
  | 	@Transactional
  | 	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



More information about the jboss-user mailing list