On Wed, 18 Mar 2015 11:14:08 -0300, Poggenpohl, Daniel
<daniel.poggenp...@isst.fraunhofer.de> wrote:
What I meant to say was they recommend @SessionState instead of
@SessionAttribute because it is a complex object.
Who said that? Anyway, I think it's an incorrect statement. It should say
"@SessionAttribute for primitive types and general-purpose classes like
String and Date, @SessionState for everything else". String is a pretty
complex class and it shouldn't be used with @SessionState.
one of my DAO services into my AppSession object.
Nope. You just need to call it in your layout class, probably in its
setupRender() method.
Or wouldn't this work because my AppSession is not a page or component?
It would, but I don't like the idea of injecting data storage objects into
session-persisted objects at all.
If this wouldn't work, then every time someone would use my AppSession
user, he would have to get() the user and then do a manual merge() or
via DAO on it.
Nope, just once per request, hence my suggestion on doing it on
setupRender() of your Layout class.
@SessionState
private AppSession appSession;
@Inject
private EntityManager entityManager;
void setupRender() {
appSession.setUser(entityManager.merge(appSession.getUser());
}
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org