Hi!

You can use two strategies:

1) use conversation.access (as you outlined) with the same conversationName. 
You can configure the conversationName in your spring config. Just use the same 
name for aBean and bBean.
This makes it easy to pass the selected bean to the second bean, and due to the 
same conversationName they share the same persistenceContext and it is no 
longer bad to pass around entities. It depends on how many additional data you 
load on your detail bean, if you load a lot of things strategy 2 might be 
better.

2) still use conversation.acces, but do not configure a conversationName. You 
end up having two persistence contexts.
In this scenario you should not pass around the entity bean, but just pass the 
primary key of the entity and reload the entity in bBean

Might be something like this:
<tr:setActionListener from="#{aBean.key}" to="#{bBean.selectedEntityKey}" />

2a) Now, you have an additional possibility. If you would like to detach the 
knowledge of the aView how to pass the key to the bView you can configure the 
UrlParameterNavigationHandler.

Look at the book excerpt here: 
http://books.google.at/books?id=FPxif81mgYoC&lpg=PA195&ots=W7nh7z6p1Z&dq=orchestra%20UrlParameterNavigationHandler&pg=PA196#v=onepage&q=orchestra%20UrlParameterNavigationHandler&f=false

Using the navigation-case configuration you are now able to pass the key from 
one view to the other.
On the receiving side you have to use the parameterMap to fetch the key and 
reload the entity then.

It depends on your application if it is feasable to render the key in the url. 
It makes them bookmarkable, but also vulnerable.


In this area it is hard to tell what is "best practice".
I normally use 1 or 2 and sometimes 2a .... :-)

Ciao,
Mario

-----Ursprüngliche Nachricht-----
Von: jid1 [mailto:ideligian...@velti.com] 
Gesendet: Freitag, 18. September 2009 17:01
An: users@myfaces.apache.org
Betreff: MyFaces Spring Orchestra Best Practice


hello,

I am trying to implement the following:

Backing bean A is used to render search results
Backing bean B is used to render the specific details of one result

I am setting both beans to "conversation.access" and don't want to 'access'
them from different components (as it's not supposed to be best practice)

Also I could use:
<tr:setActionListener from="#{aBean}" to="#{bBean.selection}" />

But:
a. The first component will access the second in the JSF domain
b. I would like to do it from the backing bean so I can call 
Conversation.getCurrentInstance().invalidate();

Can you please tell me the 'best practice' solution?
(ideally speaking these are in the same conversation, but let's say they
aren't). Any documentation links very welcomed!! 

Thanks
-- 
View this message in context: 
http://www.nabble.com/MyFaces-Spring-Orchestra-Best-Practice-tp25510295p25510295.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to