On this excellent new book :
I've read one information that surprises me about the last point of page 536 :
"You should not use transient member variables in a managed bean with a scope higher than the request, to hold UI component reference. This hard reference will prevent the UI component tree from being cleaned up."
I’m not sure to understand this sentence.
Actually, I noticed that, in generated application, a TableBean was by default in pageFlowScope with a transient member on RichTable. Is it a correct practice or not ?
Thanks you very much,
Yes, we are aware of that, while we knew it was not recommended, this code is there for many years and it is working smoothly (no memory issues encountered).
At the time we wrote the code, the ComponentReference was not working correctly yet.
Jobinesh is the first to mention a real reason why marking it transient is not a good solution.
However, his solution on using the ComponentReference is under debate as well, see this older post from Bake Sullivan:
Blake writes "The bigger problem is that this solution is still kind of lame"
Duncan blogged on another pattern to solve this issue:
We will check with Duncan, Blake and Jobinesh, and then decide on the best technique to implement with the next JHeadstart release.
Thanks you very much for your answer.
We are JHeadstart customers since 4-5 years (Government of New-Caledonia - a french island) ; We gained precious time gracefully to your solution. We don't use the generator but only some parts of runtime (generator of good ideas !).
We developped more than 50 applications with ADF (10g and 11g) ; until now we didn't need for clustered application server.
But next, we have a very big application (potentially 10 000 users) and we must be very attentive for cluster matters.
If you have more ideas before the next release of JHeadstart, we are interested !
Thanks a lot,
Gooed to hear you like JHeadstart, indeed there is a lot of useful stuff in the rumtime!
I checked internally.
This is the outcome (I will blog about it as well):
- Always use ComponentReference, even in request-scoped and backingBean-scoped beans.
- There is no need to refactor into beans with smaller scopes, unless you are using a component in a session-scoped bean. Only in session beans the Component reference is still not safe.
The next version of Jheadstart will implement these guidelines.
I've read your excellent post about my remark on :
So my goal is to change our applications for this too large scope about TableBean.
However, I have two small questions about the fact that TableBean is by default in pageFlowScope :
1/ why this bean needed to put in pageFlowScope ? Is it correct if put in requestScope ?
2/ among your solutions, which applied the best to TableBean ?
3/ and last : is it possible to get a jheadstart minor release (for jdev 188.8.131.52 / 184.108.40.206) ?
Thanks a lot,
The TableBean could have been in viewScope, in requestScope it doesn't work.
But there is no need to change the scope (requires a lot of changes!), we need to change the JHS runtime beans to use ComponentReference where applicable.
This is planned for the next release, which is planned for Q1 of 2013.