Fwd: Re DisplayGroups. Inserting and deleting objs
Fwd: Re DisplayGroups. Inserting and deleting objs
- Subject: Fwd: Re DisplayGroups. Inserting and deleting objs
- From: Jevon Hills <email@hidden>
- Date: Wed, 22 Jan 2003 15:30:49 -0700
Thanks again. So I guess my problem lies in my model definition. I
don't have available to me the method
addObjectToBothSidesOfRelationshipWithKey()
Although eomodeler defined the relationship for me it only gave the
methods
card.addToConsolesmartcardlinktable(obj)
card.removeFromConsolesmartcardlinktable(obj)
console.addToConsolesmartcardlinktable
and
console.removeFromConsolesmartcardlinktable(obj)
How do I define a relationship for the 3 tables to get the methods you
mention so I don't use id's???
For tablenames let's assume console, smartcard, and csl.
as for the list, I thought I had posted it, sorry bout that.
Jevon
Begin forwarded message:
> From: Art Isbell <email@hidden>
> Date: Wed Jan 22, 2003 3:04:52 PM Canada/Mountain
> To: Jevon Hills <email@hidden>
> Subject: Re: Re DisplayGroups. Inserting and deleting objs
>
> On Wednesday, January 22, 2003, at 10:48 AM, Jevon Hills wrote:
>
>> associateConsole()
>> {
>> for(i = 0; i< selectedConsoles.count(); i++)
>> {
>> Console con = selectedConsoles(i);
>> Link csl = new Link() //This represents the link table obj
>>
>> //setup the link table obj
>> csl.setConsoleid(con.conid());
>> csl.setCardid(card.cardid());
>> csl.setCard(card);
>
> As I stated before, you are trying too hard. You should NEVER refer
> to primary and foreign key attributes in your Java code. These should
> NEVER be class properties in your eomodel, so there should be no
> setConsoleid() or setCardid() methods defined. This is the
> traditional approach to DB programming that EOF has completely
> eliminated. EOF takes care of the above details for you, so don't try
> to do so yourself. You'll be battling EOF all along the way and
> you'll lose. Until you abandon this mindset, no one will be able to
> help you because this style of DB programming just isn't supported by
> EOF.
>
> Instead, you ALWAYS manipulate the relationship properties that are
> defined by these primary and foreign keys. If you allow EOModeler to
> define the many-to-many relationship, it will have created
> Smartcard.consoles and Console.smartcards relationships. All you need
> to do to add a console to a card:
>
> card.addObjectToBothSidesOfRelationshipWithKey(smartcard,
> "smartcards");
>
> removeObjectFromBothSidesOfRelationshipWithKey() will do just what it
> says.
>
> Also, always insert a newly-created object into an editing context
> BEFORE you set any of its properties. The editing context must
> observe such changes in order to correctly create the SQL needed to
> save the changes to a DB.
>
> Please post such requests for assistance to webobjects_dev rather
> than to me directly. Such lists are learning tools for all
> subscribers, but this educational function is lost when you request
> assistance privately.
>
> Art
> http://homepage.mac.com/aisbell/
>
>
Jevon K. Hills
Intern - Zymeta Media Promotion Systems
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.