persistence@glassfish.java.net

Re: entity relation

From: Axl Mattheus <axl.mattheus_at_gmail.com>
Date: Fri, 20 Mar 2009 06:22:47 +0200

On the id generation:
What database are you using? The 'AUTO' generation strategy should actually
be called 'DIFFERENT_FOR_DIFFERENT_DATABASES' or 'SOMETIMES_DOESNT_WORK'
would also be a good name...

ax/

2009/3/20 Eve Pokua <gorgeous65_at_msn.com>

> Hi,
>
> everyone,
>
>
> please read the following and let me know if I am on the right track.
>
> I've entities-
>
> Iteams
>
> Customer
>
> Order
>
> Orderline
>
> The Orderline breaks down the many-to many relationship for order and
> Iteams.
> Now, I do remember creating the tables before I normalised them, the system
> would
> create an extra table(which I did not specified) for Iteams and Order. So
> it would
> insert the id (s) of Iteams and Order everytime it was created.
>
> The Orderline has fields -
>
> orderid
> itemid
> cusid
> qauntity.
>
> If i move the fields back into Order and create the many-to-many
> relationship
> between Order and Iteams, then the system will many it for me. Is this the
>
> best way to manage an application like this or should I stick to my
> normalisation
> as mentioned above.
>
> Also, I would like the DB to generate the id fields automatically, so in my
> entities,
> I've specified as-
>
> @Entity
> @Table(name="ORDERS")
> public class Orderent implements Serializable {
> private static final long serialVersionUID = 1L;
> @Id
> @GeneratedValue(strategy = GenerationType.AUTO)
> private Long ordID;
>
>
> .....
>
>
> But the DB keeps asking for id when i enter new dada. Now, how do I manage
> a situation
> like this?
>
> I'd appreciate any suggestions. Thanks
>
> eve
>
>
>
> ------------------------------
> Windows Live Hotmail just got better. Find out more!<http://clk.atdmt.com/UKM/go/134665311/direct/01/>
>