• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to handle relationship properties?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to handle relationship properties?


  • Subject: Re: How to handle relationship properties?
  • From: Miguel Arroz <email@hidden>
  • Date: Tue, 3 Jan 2006 11:57:45 +0000

Hi!

  Thanks for your help! I have it working now.

It would be great if Apple allowed to have a qualifier like "user = %@", %@ being the User object. What it should do is what I do manually... using EOUtilities.primaryKeyForObject() to obtain it's primary key, and the fetch the correct object.

I guess I will submit a feature request on this, unless there is something really obvious against this I'm not thinking about...

  Yours

Miguel Arroz

On 2006/01/01, at 21:33, Miguel Arroz wrote:

Hi!

I have tried something like that, but I'm having a (probably stupid) problem... the problem is that I cannot access the relationship! I must be missing something obvious, but how do I say I want the relationship for THAT user and for THAT file? The EOSpecification only allows stuff like user email, user name, etc, and I needed a way to specify a user using it's object, and not one of its attributes. The problem is that on some classes the attributes are not enough to identify an object, as there may exist different objects (accounts, etc) with the same name. The only difference between them is their ID (primary key on the DB), that is hidden from the Java layer.

Remember that these are many-to-many relationships, so I cannot just access the user.file key...

  Yours

Miguel Arroz

On 2006/01/01, at 16:48, Arturo Pérez wrote:

On Jan 1, 2006, at 9:53 AM, Miguel Arroz wrote:

Hi!

  Imagine I have the following scenario:

  - An entity "user".
  - An entity "file".
  - A many-to-many relationship between both.

Now, I want to store something like the access permissions a user have over each file. The obvious way to do that is storing that data in the relationship itself. What's the best way to do that in WebObjects? The problem is that the userFile record is only created when inserting the "user" and "file" records in the DB, so I cannot access it (and change it) before a save. But if I save, I get an error that I'm violating the non-null constraints. Of course, I may drop the non-null constraint, but this seems a bit ugly to me...

  How do you guys do this kind of stuff?


The obvious way is the correct way. In this situation, one cannot use flattened relationships as one needs to access the relationship directly. Other than that, there's no trick to it.


Set up User, File and UserFile EOs, create&instantiate all three, and use addObjectToRelationshipWithKey to connect them up.

-arturo



"The world lies in the hands of evil
 And we pray it would last" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40guiamac.com


This email sent to email@hidden


"The world lies in the hands of evil
 And we pray it would last" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com




_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: How to handle relationship properties?
      • From: Arturo Pérez <email@hidden>
References: 
 >How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Arturo Pérez <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)

  • Prev by Date: WebApplication design problem
  • Next by Date: Re: How to handle relationship properties?
  • Previous by thread: Re: How to handle relationship properties?
  • Next by thread: Re: How to handle relationship properties?
  • Index(es):
    • Date
    • Thread