On Mon, 2011-02-21 at 02:27 -0800, robnangle wrote:
> User user = userDao.get(loginName);
> 
> The above line, is the user entity class? And what is the userDao doing?

User could be an entity, depends on whether you are using an ORM or not.
Generally though your DAO is going to return an object of some
description, right?

userDao is just a hypothetical DAO for retrieving users from the db.
Most applications I imagine have something similar. If you're using
spring you can just inject the DAO into your page or component:

@Inject
private UserDao userDao;


> 
> stateManager.set(User.class, user);
> 
> This is setting the user as the current state?

This just puts the retrieved user object into the session as an SSO.
This means it is accessible from all pages/components, unlike say
@Persist'd quantities which are scoped to individual pages/components.
You can stick whatever you like into the session, but for reasons of
overhead should really be limited to simple objects or primitive types.


> User user = stateManager.get(User.class);
> 
> And the above is just returning the current user?
> 

Correct. So now you could get some records for that user:

List<Record> records = recordDao.get(user.getId());

(or if using an ORM: recordDao.get(user);








---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to