• 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: Unique ID without create entity?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unique ID without create entity?


  • Subject: Re: Unique ID without create entity?
  • From: Guido Neitzer <email@hidden>
  • Date: Sat, 4 Oct 2008 12:15:36 -0600

On 04.10.2008, at 02:11, Yung-Luen Lan wrote:

Thanks for your suggestion. Could you elaborate more? Why is using PK
considered as a bad style?

A pk or fk is organizational information for the database that has no meaning for an actual data object in Java land. If you introduce a meaning, e.g. use this information for something in Java land, you are mixing organizational with actual information.


Unfortunately I do the same in some instances, but this is because I didn't know better when I created the model years ago.

If for whatever reason you need the pk before saving an object, you can use a Wonder feature "primaryKeyInTransaction" (careful, that doesn't work with child editing contexts), where you get the pk before the object is saved to the db. But with that hint, I only give you the gun to shoot yourself in the foot. I do not, really do not, recommend doing this.

I started using EOF byte[24] keys a while ago to prevent myself from using pks for anything else. These can have other problems (database and indexing related, if your database is not very fast indexing tables on these keys), but they help seeing the relational information as nothing else and to avoid touching it.

cug


-- Real World WebObjects Bootcamp at the Big Nerd Ranch: http://www.bignerdranch.com/classes/real-world_webobjects.shtml

_______________________________________________
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


References: 
 >Unique ID without create entity? (From: "Yung-Luen Lan" <email@hidden>)
 >Re: Unique ID without create entity? (From: Guido Neitzer <email@hidden>)
 >Re: Unique ID without create entity? (From: "Yung-Luen Lan" <email@hidden>)

  • Prev by Date: Browser Headers
  • Next by Date: Web App Interfaces
  • Previous by thread: Re: Unique ID without create entity?
  • Next by thread: Browser Headers
  • Index(es):
    • Date
    • Thread