users@glassfish.java.net

entity relation

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Fri, 20 Mar 2009 01:43:00 +0000

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

 

 

_________________________________________________________________
View your Twitter and Flickr updates from one place – Learn more!
http://clk.atdmt.com/UKM/go/137984870/direct/01/