users@glassfish.java.net

Re: pb autogenerate database

From: Jacob Kessler <Jacob.Kessler_at_Sun.COM>
Date: Mon, 06 Oct 2008 11:14:58 -0700

When you are doing that, you need to use the primary key because it is
guaranteed to be unique (and thus the keys in patient_treatment will be
unique). I agree with Marina that the right way to set up this database
is with the IDs as primary keys and use business logic to check for
duplicate entries, since you will be able to deal with situations like
two John Smiths having the same birthday (when you do really want to
have two entries with the same first name, last name, and birthday). In
general, relying on PK-uniqueness to prevent duplicate data is a much
worse solution than actually checking to make sure that you aren't
trying to enter duplicate data.

glassfish_at_javadesktop.org wrote:
> excuse me i haven't enought tim ethis week end to reply.
>
> I want to use the id to link my 2 tables and this id is the PK of this table.
>
> exemple
>
> table 1: patient
> int idpatient
> #name
> #first_name
> #birthday
> .....
>
> table 2:treatement
> int idttreatement
> #idtypetreatement
> #datetreatement
> .....
>
> table 3:patient_treatement
> #idpatient
> #idtreatement
> [Message sent by forum member 'pfhuillet' (pfhuillet)]
>
> http://forums.java.net/jive/thread.jspa?messageID=303442
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>