[jboss-user] [JBoss Seam] - Re: Wannabe-Example needs help growing up

pete.muir@jboss.org do-not-reply at jboss.com
Mon Sep 17 18:32:48 EDT 2007


"stephen.friedrich" wrote : (Why can't I attach files here?)

Soon now we shall be moving to a new forum (I can't wait :)

anonymous wrote : * Is it ok to "manually" add a newly created entity to the entity query's result list like this (in EmployeeHome):
  | 
  |   | 	public String persist() {
  |   | 		String outcome = super.persist();
  |   | 		employees.getResultList().add(getInstance());
  |   | 		return outcome;
  |   | 	}
  |   | 

It's a bit strange ;) In Seam2 we have org.jboss.seam.afterTransactionSuccess.Employee (assmuming the entity you EmployeeHome is named Employee) - so you can observe this event and when it occurs you can call employees.refresh() - this is the nice way to do it.

Does doing a flush and then a employees.refresh() not work in 1.2.1?

anonymous wrote : * At first after deleting an employee the employee's details were still shown in the detail form (but editing/resubmitting the form caused an exception of course). I tried to get around this by overriding the remove method in EmployeeHome:
  | 
  |   | 	public String remove() {
  |   | 		String outcome = super.remove();
  |   | 		setId(null);
  |   | 		return outcome;
  |   | 	}
  |   | 
  |   After that the detail form was indeed empty after deleting an employee.
  |   Still when you delete an employee, then fill in data in the detail form (without first selecting another employee or clicking on "Create New Employee) and click on "Create" it still crashes with an exception. Any idea?


Current CVS gives you a clearInstance() method - it's

   
  |    public void clearInstance()
  |    {
  |       setInstance(null);
  |       setId(null);
  |    }

try that and get rid of it when you upgrade.
anonymous wrote : * Why do I need to add a newly created employee to the list myself, but a deleted employee is removed from the list automatically?

Probably to do with when the list refreshes (the EntityQuery is request scoped).

anonymous wrote : * Currently it seems that the whole list of employees is reloaded from DB each time I select another employee in the list (by clicking the edit button).

Yup, the query is request scoped ;) You can make it Conversation scoped but then you have to manually manage refreshs (easier when you have the events discussed above).
 
anonymous wrote :  How can I achieve this behaviour:
  |   - The list should only be reloaded when selecting the "area", i.e. when clicking on the "Employees" link in the header.

Put the query into conversation scope and use an action to refresh when you click the button.

anonymous wrote :   - However when a single employee is selected that single employee  should be reloaded from DB prior to showing it in the details area. (To be sure to 
  |     start the edit using the most up-to-date data.) When the employee has already been deleted, then a message should be shown instead and it should be removed from the list.

The Home should always load a instance from the db, not the EntityQuery.  

anonymous wrote :   - Ideally when opening another employee "area" in a new browser tab (by ctrl-clicking (with firefox) on an edit button or the "Employees" header) then the new tab should act independently from the first (i.e. loading the employee list once, when opened and refreshing a single employee on each selection).

This should happen if you are using conversations

anonymous wrote : * In seampay the PaymentHome had a "@RequestParameter Long paymentId;" declaration. Is it really needed? Seems to be unused, but it's hard to tell because there's always so much going on behind the scene when using seam.

Is the paymentId used in the code? If not, its not needed (@RequestParameter is just an injector).

HTH!

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

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



More information about the jboss-user mailing list