[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Using several collection mapping of the same type
|
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