Looking through the archives I saw some posts that said you should not
store entity objects [for example object coming from hibernate] in the
session.  This makes sense to me as I just hit the problem.

The archives gave lots of advice but everything seemed to contradict and
no one posted a working solution.

 

Current architecture:

My wicket application is implementing Guice and Warp-Persist.

 

I have a MySession object which extends WebSession.

 

Inside MySession I wanted to store the entity object called Account
[which has a bunch of lazy load properties from hibernate].  Obviously
this isn't going to work.

 

I have a MyUnauthorizedListener which implements
IUnauthorizedComponentInstatiationListener so that I can send the user
to a 'change password' page based on properties in their Account [flag
for changing password or a time limit since last password change] or to
a 'login' page if the password doesn't need to be changed.

 

I also have a MyUserRolesAuthorizer which implements
IRoleCheckingStrategy so that I can see if the account has the proper
roles to view certain pages.

 

Solution Tried:

I thought of just storing the id of the account in the session.  Then
when I need the actual Account object I can just pull it from the db.
This works fine on Pages but I can't inject the DAO into
MyUnauthorizedListener and MyUserRolesAuthorizer since Guice only
injects into components [correct?]

 

 

Do I need to pass the Dao to MyUnauthorizedListener and
MyUserRolesAuthorizer via the WebApplication [assuming this is a
component]?

Any ideas? Solutions?  Or have I architected this incorrectly?

 

Thanks.

 

 

Reply via email to