If I switch to seam managed persistence tree does not work
What, precisely, breaks?
(There should be no problem injecting a SMPC into a session-scoped component)
There should be no problem injecting a SMPC into a session-scoped component
That is, if the conversation context is active. (eg, not during RestoreView).
Matt, the problem is that the SMPC is not session scoped,so therefore stuff loaded by the SMPC becomes unmanaged inside that bean (I guess this is the problem, it normally is).
There are a number of techniques discussed on the forum a few times for dealing with this.
I;ve build a tree using richfaces and seam. The tree model is saved into a session stateful component.
I used Extended Persisence Context and all works but it seems that that exteded persistence context does not propagate into DAO objects (Stateless session beans).
If I switch to seam managed persistence tree does not work (i supose because seam managed persistend only work inside conversation - and this cannot be the case because the tree is displayed all the time).
How can I make the dao called from "leftTreeBean" use the same EntityManager?
I made the SMPC into a conversation scoped and it works. But I don't know in your case.
Just for clarification some of my requirements:
- Session scoped "leftTreeBean" (because conversation is too short)
- "leftTreebean" provides a getRoot method that creates a new TreeNodeimpl and makes db query to populate first level of the tree. Tree nodes are a custom class ClazzTreeNode.
ClazzTreeNode is not a seam component. Just a java object. Its "getChildren" makes a database call to a dao to find out the children of a specific node.
I would like to push the code to findChildrens, findFirstLevel and so on into another classes (DAO) to be able to reuse them.
Note:During working with the application tree can be modified.
Tree is huge (about 2.5 million nodes) so it cannot be loaded in memory.
I expect DAO-s to be stateless session beans
I use richfaces with ajax switch type.
Any critics to this design ?