does this work for me? Any problem could you see?
i will load members companies of specified company from database and save it in memory.
my DAO will be like this.
///////////////////////////////////////////////
class CompanyDAO{
HashMap loadedCompanies;
get(String id){}
del(String id){}
delMemory(String id){
return loadedCompanies.remove(id);
}
getMemory(String id){
return loadedCompanies.get(id);
}
...
}
////////////////////////////////////////////////
So that i can have only one instance for all objects.
-----Original Message-----
From: An interest list for Sun Java Center J2EE Pattern Catalog [mailto:J2EEPATTERNS-INTEREST@(protected)
Sent: Wednesday, January 05, 2005 4:23 PM
To: J2EEPATTERNS-INTEREST@(protected)
Subject: Re: Object relationship
Depending on your usage, you may also want to consider a
TransferObjectAssembler to differentiate between cases when you need the
company with sub-companies or without. Then apply the Mutiple Transfer
Object strategy so you have slightly different TransferObjects (ValueObjects)
for the two cases. One could be a subclass of the other to make things a bit
more transparent.
--
Jonathan Petruk
J. Petruk Consulting Inc.
E-mail: jon@(protected)
http://www.petruk.net/
On Wed, 5 Jan 2005 14:13:43 -0000, Ramnish Kalsi wrote
> This would actually depend upon the usage. If the company object is not
> complete without members information, then yes, you would have to
> load the member information.
>
> Alternately, if you do not need the information about the members,
> you could either maintain a list of ID's of the organization
> (instead of whole objects) , that this company is member of.
>
> But, firstly, you should redefine your business model slightly -
> when you say "a company is member of other companies", what exactly
> do you mean. Is it an amalgamation of companies ?? If so, will the
> company object be accurate depiction of this umbrella business
> entity. ?
>
> think about these before you finalise your model.
>
> --ramnish.
>
> -----Original Message-----
> From: An interest list for Sun Java Center J2EE Pattern Catalog
> [mailto:J2EEPATTERNS-INTEREST@(protected)
> VOLODYA (YAZ-ArGe)
> Sent: 05 January 2005 14:03
> To: J2EEPATTERNS-INTEREST@(protected)
> Subject: Object relationship
>
> Hi all,
>
> a company can be member of other companies.
> class company{
> ArrayList membersOf;
> }
>
> when i load this company from database, do i have to load member companies
> too?
> if yes, i must load members of the members'. huh?
> if no, nullpointer issue !!!
>
> how do i handle that?
>
> thanks.
> Bayarsaikhan VOLODYA
>
> ====================================================================
> Companion Site: http://www.corej2eepatterns.com
> J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
> List Archive:
> http://archives.java.sun.com/archives/j2eepatterns-interest.html
> Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to
> listserv@(protected)
>
> ********************************************************************** This
email and any files transmitted with it are confidential and intended solely
for the use of the individual or entity to whom they are addressed. If you
have received this email in error please notify the system manager.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
>
> www.mimesweeper.com
> **********************************************************************
>
> ====================================================================
> Companion Site: http://www.corej2eepatterns.com
> J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
> List Archive: http://archives.java.sun.com/archives/j2eepatterns-
interest.html
> Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to
listserv@(protected)
====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)