• 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: Do entities require a primary key?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do entities require a primary key?


  • Subject: Re: Do entities require a primary key?
  • From: Johnny Miller <email@hidden>
  • Date: Thu, 10 Dec 2009 09:30:42 -1000

Just checked it to make sure.  And yes both columns are unique.

Thanks for the heads up.

Johnny

On Dec 10, 2009, at 2:42 AM, David Avendasora wrote:

>
> On Dec 9, 2009, at 6:35 PM, Chuck Hill wrote:
>
>>
>> On Dec 9, 2009, at 3:25 PM, Johnny Miller wrote:
>>
>>> The table has two columns an "IP_FROM" and an "IP_TO", each contains an IP number.
>>>
>>> According to the manual after you convert an IP address to an IP number it can only resolve to one row in the database i.e.
>>>
>>> IP_FROM <= X <= IP_TO
>>>
>>> So, I'd assume that the multi-column PK would work because the combo of IP_FROM and IP_TO has to be unique.  I've never created column pk like that before - can I find the info in the Apple supplied docs?
>>
>> Nothing to it, just mark both as primary key columns in Entity Modeler.  Look  at a many to many join table for an example.
>
> If, for some reason, the combination of those two fields is not unique it can really confuse EOF. See my message from earlier on December 9th about duplicate pointers in an NSArray of related objects.  http://lists.apple.com/archives/webobjects-dev/2009/Dec/msg00286.html
>
> If there's any way you can simply add a new column to the table that has a unique value in it and mark that as the PK, that would be even better. I really dislike compound PKs.
>
> Dave
>
>
>>>
>>> re: raw SQL.  Yeah, I planned on that.
>>>
>>> Thanks a lot,
>>>
>>> Johnny
>>>
>>>
>>> On Dec 9, 2009, at 1:12 PM, Chuck Hill wrote:
>>>
>>>> Are the rows unique?  If so, you can  make a multi-column PK.  EOF needs _something_ to uniquely identify them if you want to make EOs out of the data.  You  might also want to consider just raw SQL (raw rows) and / or making  a cache of these and avoiding the EO overhead.
>>>>
>>>> Chuck
>>>>
>>>> On Dec 9, 2009, at 3:04 PM, Johnny Miller wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I just purchased a database that does IP address to country resolution.  I'm reverse engineering the database into a Wonder Framework and I realized that the single table in the database doesn't have a primary key.  WOLips doesn't like this and throws an error stating the entity does not have a primary key.
>>>>>
>>>>> Should I just create a primary key field and leave it blank?  Or is there a better alternative?  This is going to be a read only database.
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Johnny Miller
>>>>> Kahalawai Media Corp
>>>>> http://www.kahalawai.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
>>>>
>>>> --
>>>> Chuck Hill             Senior Consultant / VP Development
>>>>
>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>> http://www.global-village.net/products/practical_webobjects
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> Johnny Miller
>>> Kahalawai Media Corp
>>> http://www.kahalawai.com
>>>
>>>
>>>
>>
>> --
>> Chuck Hill             Senior Consultant / VP Development
>>
>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
> David Avendasora
> Senior Software Engineer
> K12, Inc.
>
> *****
> WebObjects Documentation Wiki : http://wiki.objectstyle.org/confluence/display/WO/
> *****
> WebObjects API: http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/index.html
> *****
>

Johnny Miller
Kahalawai Media Corp
http://www.kahalawai.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: Do entities require a primary key?
      • From: Clark Mueller <email@hidden>
References: 
 >Do entities require a primary key? (From: Johnny Miller <email@hidden>)
 >Re: Do entities require a primary key? (From: Chuck Hill <email@hidden>)
 >Re: Do entities require a primary key? (From: Johnny Miller <email@hidden>)
 >Re: Do entities require a primary key? (From: Chuck Hill <email@hidden>)
 >Re: Do entities require a primary key? (From: David Avendasora <email@hidden>)

  • Prev by Date: Re: WebObjects Installer (Wonder, WOLips and utilities)
  • Next by Date: Re: Do entities require a primary key?
  • Previous by thread: Re: Do entities require a primary key?
  • Next by thread: Re: Do entities require a primary key?
  • Index(es):
    • Date
    • Thread