I made this mistake once. We spent a LOT of money getting rid of them and in
our case using a meaningful primary key actually stalled our business for
the few months it took to get rid of them.
Don't Do It!
J
On Mon, Feb 2, 2009 at 6:22 AM, Pierre Lavignotte <
pierre.lavignott..mail.com> wrote:
> > Do poeple agree w/ me here?
>
> I do !
>
> All my tables have an autogenerated integer ID. I just need to read it to
> point a specific row but I do NOT define it in Cayenne Modeler because
> (until now) each time you have to re-engineer you DB schema you lose all
> the
> fields you have manually designed and I don't want these fields to be
> writable.
>
> Cheers
>
> Cordialement,
> Pierre Lavignotte
> Ingénieur Conception & Développement
> http://pierre.lavignotte.googlepages.com
>
>
> On Mon, Feb 2, 2009 at 3:15 PM, Eric Lazarus <ericllazaru..ahoo.com>
> wrote:
>
> > I can't let this point(er) go buy: JUST SAY NO TO MEANINGFUL POINTERS!
> >
> > There are BIG problems with having meaningful primary keys in general in
> > terms of keeping your program growing and useful long term. When you can
> > avoid it, avoid it... and when YOU are designing the underlying database
> > from scratch, I think you can almost always avoid it. Putting meaning in
> the
> > pointers is often the reason that a system needs to be re-written or
> pitched
> > and replaced.
> >
> > A client of mine had to replace an existing application because they had
> > used four budget product codes as part of a pointer field and could no
> > longer represent the number of products in four digits. Cost huge $ to
> > upgrade to SAP...
> >
> > Here is another example, a bad choose made by apple early on, putting
> data
> > into what amounts to a pointer:
> >
> > http://en.wikipedia.org/wiki/Mac_OS_memory_management
> >
> > So, now it seems that the name and DOB of each person is not going to
> > change. Later it turns out that they do change under some situations and
> now
> > you have to write big hacks to deal with it.
> >
> > Just say no to meaning in pointers! Keep pointers STUPID! Meaningless bit
> > squences make great pointers in OO programs. That's my view.
> >
> > Of course rules are made to be broken and, when the DB exists already and
> > is used by a big pile of existing code, you likely have no choice but in
> > other situations, try to avoid meaningfulness in pointers.
> >
> > Do poeple agree w/ me here?
> >
> > Eric
> > +1 (917) 589-6579
> >
> > --- On Mon, 2/2/09, Pierre Lavignotte <pierre.lavignott..mail.com>
> wrote:
> >
> > From: Pierre Lavignotte <pierre.lavignott..mail.com>
> > Subject: Re: How to create Meaningful Primary Keys?
> > To: use..ayenne.apache.org
> > Date: Monday, February 2, 2009, 8:28 AM
> >
> > I don't think his question is about sequence usage but about selecting
> rows
> > with specific PK values...
> >
> > Cordialement,
> > Pierre Lavignotte
> > Ingénieur Conception & Développement
> > http://pierre.lavignotte.googlepages.com
> >
> >
> > On Mon, Feb 2, 2009 at 2:25 PM, Alessio Giovanni Baroni <
> > alessiogiovanni.baron..mail.com> wrote:
> >
> > > It's all ok. But, you are sure that in Entity screen, you are selected
> > > "Custom Sequence" on the "PK Generation Strategy"?
> > > If you do it, AND you add a filed relative to a pk column, you can
> > handling
> > > the keys, without the cayenne's control.
> > >
> > > Hi.
> > >
> > >
> > > 2009/2/2 Νίκος Παράσχου <niparas..mail.com>
> > >
> > > > First of all thank you for your replies.
> > > >
> > > > I have the following table:
> > > >
> > > > Vehicle (
> > > > plate_num CHAR(10) NOT NULL,
> > > > mixed_weight DOUBLE PRECISION NOT NULL,
> > > > type CHAR(30) NOT NULL,
> > > > manufacturer CHAR(20),
> > > > PRIMARY KEY (plate_num)
> > > > )
> > > >
> > > > In Cayenne Modeller I have the dbEntity "vehicle" with all
> > the above
> > > > attributes (plate_num is check as PK). There is also the objEntity
> > > > "Vehicle" with all the above attributes except the PK
> > (plate_num).
> > > >
> > > > I want to select the type of the vehicle with plate_num =
> > "AHZ-4141".
> > > >
> > > > Could you please post some code samples? I have tried so many things
> > > > (with DataObjectUtils too) but still no success.
> > > >
> > > > Thank you,
> > > > Nikos
> > > >
> > > > Στις 02-02-2009, ημέρα Δευ, και ώρα 12:49 +0100,
> > ο/η Pierre Lavignotte
> > > > έγραψε:
> > > > > Hi Nikos,
> > > > >
> > > > > If you need PK for all your tables, then maybe you need to
> > generate
> > > them.
> > > > > But if you only need to use them for a couple tables then you
> > should
> > > look
> > > > at
> > > > > DataObjectUtils class.
> > > > >
> > > > >
> > > > > Cheers,
> > > > > Pierre
> > > > >
> > > > > Cordialement,
> > > > > Pierre Lavignotte
> > > > > Ingénieur Conception & Développement
> > > > > http://pierre.lavignotte.googlepages.com
> > > > >
> > > > >
> > > > > On Mon, Feb 2, 2009 at 12:35 PM, Νίκος Παράσχου
> > <niparas..mail.com>
> > > > wrote:
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > It is the first time I am using cayenne and I have some
> > questions
> > > > > > regarding the primary keys.
> > > > > >
> > > > > > What I want to do is select some rows of a table where the
> > PK has a
> > > > > > specific value. The problem is I can't access the PK. I
> > can specify
> > > > > > qualifiers only with the non-PK columns. The PKs I am using
> > have some
> > > > > > meaning (they are not just numbers) so it is very important
> > to be
> > > able
> > > > > > to use them.
> > > > > >
> > > > > > How can I add the PK to the fields of the Object Entities?
> > > > > >
> > > > > > In this page
> > > > http://cayenne.apache.org/doc20/primary-key-generation.html
> > > > > > the answer is to create a Meaningful Primary Key.
> > > > > >
> > > > > > How can I create Meaningful Primary Keys?
> > > > > >
> > > > > > Are there any security issues when using Meaningful Primary
> > Keys?
> > > > > >
> > > > > > Thank you for your time,
> > > > > > Nikos
> > > > > >
> > > > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
>
This archive was generated by hypermail 2.0.0 : Mon Feb 02 2009 - 09:58:18 EST