persistence@glassfish.java.net

RE: entity relation

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Fri, 20 Mar 2009 09:40:34 +0000

Hi,

 

ax

 

I'm using the javadb that comes with glassfish installer. Though, my aim is to

use MS 2005 express. I'm just having issues with the driver at the moment.

 

thanks

 

eve
 


Date: Fri, 20 Mar 2009 06:22:47 +0200
From: axl.mattheus_at_gmail.com
To: persistence_at_glassfish.dev.java.net
Subject: Re: entity relation

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!

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