One more newbie question

Keith Hodges keith_hodges at yahoo.co.uk
Mon Oct 9 22:48:32 UTC 2006


Hello,

I was asking similar questions a while  back. These links may help:

http://article.gmane.org/gmane.comp.lang.smalltalk.squeak.magma/276/match=questions
http://article.gmane.org/gmane.comp.lang.smalltalk.squeak.magma/280/match=questions

In your companies example I think it depends upon how UserA and UserB 
find their companies.

Let us say, UserA's company instance is assigned by looking in the 
database for the company, say in a collection of  possible companies. 
Alternatively UserA's company instance is set by referencing an instance 
of company that is already persisted in the database somewhere.

When UserB selects their company by the same means, then it will be the 
same instance in the persisted model.

I suspect that if you instanciate two different company instances in 
User's A&B without any previous reference to the model that when each is 
persisted they will be persisted as two separate entities despite the 
fact that all of their attributes may be the same.

There may be a way of indicating identity in such a way as to inform the 
database that these objects are the same. In the same way as you can 
define = and hash on an object so that Set sees two objects as 
Identical. I havnet come across this yet.

If you arrange for your companies to be persisted in some form of 
keyes/indexed collection and found from there, then the users are likely 
to find the same company instance.

hope this helps

Keith





		
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html


More information about the Magma mailing list