[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: state & persistence of child objects
From:       Hugo Palma <hugo.m.palma () gmail ! com>
Date:       2006-04-27 22:40:26
Message-ID: 4451485A.9080209 () gmail ! com
[Download RAW message or body]

What i usually do is add a private attribute to my ASO with the object 
id and let a getter method in the ASO retrieve the whole object from the 
database when needed. It would look something like:

public class MyAso implements Serializable
{
  private Long _loggedUserId;

  public User getLoggedUser()
  {
     return getUserDao().getUser(_loggedUserId);
  }
}


Cheers

Hugo

Gareth Deli wrote:
> I am currently developing a small-ish web application using tapestry & 
> trails, and was hoping someone might give an opinion on a design issue:
>
> I have a userAccount object, which has collections of objects 
> associated with it in hibernate.  What this means is that I need to 
> have the hibernate id of the userAccount object for the user currently 
> logged in (because it would be inappropriate to make them select it 
> from a list of all accounts on the system)...  What is the best way of 
> achieving this?
>
> Because the userAccount Object would potentially get quite large, 
> would a good solution be as follows:
>
> 1. Create a small CrucialInfo object and store the id of the account 
> (along with anything else i havent thought of yet) in this
> 2. Store that object using hivemind as a session state object
> 3. Inject the CrucialInfo object into the appropriate pages
> 4. Read the accountId from the injected CrucialInfo object just before 
> child objects are persisted to the database
>
> Trails has the concept of of a defaultEdit page... assuming the above 
> solution is good, is reflection a good way to store that accountId 
> value into a (always the same) field on the objects, essentially by 
> extending the org.trails.EditPage?
>
> Thanks
>
> Gareth Deli
> g01z@yahoo.co.uk
>
>        
> ___________________________________________________________ 24 FIFA 
> World Cup tickets to be won with Yahoo! Mail http://uk.mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic