[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [eclipselink-users] Using several collection mapping of the same	type
 | 
Hello,
They should not be using the same relation table.  You need to define 
atleast one of the OntToMany mappings to use different table using the 
JoinTable annotation or you will get into problems when it tries to 
remove from the table as well.
Best Regards,
Chris
Pierre-Yves SAUMONT wrote:
Hi,
I could not find information about the following case: An entity as 
several properties that are collection of another same entity.
For example, a Client entity has a collection of Order called 
executedOrderList and a second called pendingOrderList.
This is declared in Client as :
@OneToMany(cascade = CascadeType.ALL)
List<Order> executedOrderList;
@OneToMany(cascade = CascadeType.ALL)
Lsit<Order> pendingOrderList;
This results is an table called CLIENT_ORDER with three columns:
CLIENT_UNIQUEID, EXECUTEDORDERLIST_UNIQUEID, PENDINGORDERLIST_UNIQUEID
with a composite primary key:
PRIMARY KEY CLIENT_UNIQUEID, EXECUTEDORDERLIST_UNIQUEID, 
PENDINGORDERLIST_UNIQUEID
so far, so good.
The problem is that all three columns in that table must be non null 
and have no default value which result in an error as soon as one 
entry is added since it automatically have one of the two last column 
null.
I can workaround this by editing the create.sql generated file and 
either adding DEFULT "" or removing NOT NULL.
My question is how can I make eclipselink generate this correctly, so 
that I do not need to edit the generated SQL manually ?
Pierre-Yves
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users