Re: How to create Meaningful Primary Keys? JUST SAY NO TO MEANINGFUL POINTERS!

2009-02-02 Thread Malcolm Edgar
I think what we are talking about are surrogate primary keys. http://en.wikipedia.org/wiki/Surrogate_key Which is generally accepted as a best practice (well mostly, depending on the DBA). regards Malcolm Edgar On Tue, Feb 3, 2009 at 1:48 AM, Matt Kerr wrote: > > Do poeple agree w/ me here? >

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Nikos Paraschou
The point about saying "no to meaningful pointers" is very clear. Thank you for your replies and advice. I will perform some tests as soon as I can and come back with feedback, if I encounter any problems. Regards, Nikos Στις 02-02-2009, ημέρα Δευ, και ώρα 14:21 +0100, ο/η Pierre Lavignotte έγρ

Re: How to create Meaningful Primary Keys? JUST SAY NO TO MEANINGFUL POINTERS!

2009-02-02 Thread Matt Kerr
> Do poeple agree w/ me here? yes. On Mon, Feb 2, 2009 at 9:15 AM, Eric Lazarus 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 t

Re: How to create Meaningful Primary Keys? JUST SAY NO TO MEANINGFUL POINTERS!

2009-02-02 Thread John Armstrong
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.lavigno...@gmail.com> wrote:

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Alessio Giovanni Baroni
But to have the full control on handling the primary keys, I always set the strategy option, else the keys are handled by cayenne. 2009/2/2 Pierre Lavignotte > I don't think his question is about sequence usage but about selecting rows > with specific PK values... > > Cordialement, > Pierre

Re: How to create Meaningful Primary Keys? JUST SAY NO TO MEANINGFUL POINTERS!

2009-02-02 Thread Pierre Lavignotte
> 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

Re: How to create Meaningful Primary Keys? JUST SAY NO TO MEANINGFUL POINTERS!

2009-02-02 Thread Andrus Adamchik
Do poeple agree w/ me here? I agree, but I tend to be pragmatic in such situations. When I have a choice, I always use generated opaque (meaningless) keys for the reasons quoted below. When I don't, I map the DB the way it is given to me. Andrus On Feb 2, 2009, at 4:15 PM, Eric Lazarus

Re: How to create Meaningful Primary Keys? JUST SAY NO TO MEANINGFUL POINTERS!

2009-02-02 Thread Eric Lazarus
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

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Andrus Adamchik
And to add to that, it is perfectly valid to manually create an ObjAttribute in the Modeler for plate_num to make it an object property, even though it's a PK. Cayenne doesn't do it by default, but the user can still map it if there is a need. In fact the upcoming 3.0M6 will even have this

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Pierre Lavignotte
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.bar...@gm

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Alessio Giovanni Baroni
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 Νίκος Παράσχου > First of all thank you fo

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Pierre Lavignotte
Here is what I use when I want to get Recomaster entity with primary key = id : Recomaster recomaster = (Recomaster) DataObjectUtils.objectForPK(context, Recomaster.class, id); And in the Recomaster class, I also have a method that gives me the primary key : public Integer getId() {

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Νίκος Παράσχου
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

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread Alessio Giovanni Baroni
When you create the mapping table->object, you must to specify "PK Generation Strategy" as "Custom Sequence", and you have control complete on keys handling. Next, in the attributes of the table and the relative object, you must to add the field for the primary key, selecting the field PK also. Al

Re: How to create Meaningful Primary Keys?

2009-02-02 Thread 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.go

How to create Meaningful Primary Keys?

2009-02-02 Thread Νίκος Παράσχου
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