• 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: Basic question - lightweight to-one relationship from entity to POJO/enum
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic question - lightweight to-one relationship from entity to POJO/enum


  • Subject: Re: Basic question - lightweight to-one relationship from entity to POJO/enum
  • From: Ramsey Lee Gurley <email@hidden>
  • Date: Wed, 14 Apr 2010 21:49:29 -0400

On Apr 14, 2010, at 6:07 PM, David Avendasora wrote:

> I've always just created Entities for these types of things so all relationships work the same.

For me, it depends on the usage.  If it is something like a transaction state (e.g. ACCEPT, DECLINE, ERROR) I would go with an enum. In a case like that, the enum value is going to determine program logic. In other words, I'm not going to add a new state to the database (REVIEW for instance) and then have the app magically know what to do with it.  I know there are cases where an enumeration entity makes sense, but for me, those are synonymous with a shared editing context.  If it is possible, I avoid them.

Besides, enums are pretty nifty! (^_^) I like them. I can use them in switches, they make great singletons, and they can work like operators... pretty neat stuff.


> Is there substantial savings to doing things this way over simply having EOs?
>
> Dave


Well, there's only going to be one of each enum in memory.  So, that's a bonus.  They are fast to access... I don't block a thread waiting on a fault.  That's good too. On that same line of thought, there's no need to prefetch them.  Does any of that make a big difference? I don't know.  Can't hurt though (^_^)

Ramsey


>
> On Apr 8, 2010, at 4:52 AM, Mark Wardle wrote:
>
>> Hi all, please forgive a very simple question but I'd like to create a
>> lightweight (non-EO) to-one relationship from an EO. I make heavy use
>> of D2W so I want to fulfil the WO/EOF rules and use to-one
>> relationship components....
>>
>> I usually create a new entity and have a genuine heavyweight EOF
>> relationship but I have several properties for which this seems
>> excessive.
>>
>> I have an entity (FormEdssFull) which can have a visual field score
>> for both right and left eye.
>>
>> Can I do this with a java enum?
>>
>> public enum VisualAcuity {
>> NORMAL(0, "Normal"),
>> SIGNS_ONLY(1, "Signs only:"),
>> MODERATE(2, "Moderate"),
>> MARKED(3, "Marked");
>>
>> /* insert enum constructor etc... */
>> }
>>
>> and then create the appropriate accessor and mutator in the entity?
>>
>> What do other people do in these situations?
>>
>> Many thanks,
>>
>> Mark
>>
>> --
>> Dr. Mark Wardle
>> Specialist registrar, Neurology
>> Cardiff, UK
>> _______________________________________________
>> 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
>>
>>
>
> _______________________________________________
> 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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: Basic question - lightweight to-one relationship from entity to POJO/enum
      • From: David Avendasora <email@hidden>
References: 
 >Basic question - lightweight to-one relationship from entity to POJO/enum (From: Mark Wardle <email@hidden>)
 >Re: Basic question - lightweight to-one relationship from entity to POJO/enum (From: David Avendasora <email@hidden>)

  • Prev by Date: To-Many qualifier question
  • Next by Date: Re: You don't have permission to access /cgi-bin/WebObjects/TheApp.woa/-5579 on this server.
  • Previous by thread: Re: Basic question - lightweight to-one relationship from entity to POJO/enum
  • Next by thread: Re: Basic question - lightweight to-one relationship from entity to POJO/enum
  • Index(es):
    • Date
    • Thread