I am trying to solve the following issue :
Code:
create table B (
businessKey NUMBER(19,0) not null,
version NUMBER(10,0) not null,
tbeg DATE not null,
payload VARCHAR2(255),
vbeg date,
vend date,
tend timestamp not null,
status CHAR(1) not null,
c_businessKey NUMBER(19,0),
primary key (businessKey, version)
)
create table C (
businessKey NUMBER(19,0) not null,
version NUMBER(10,0) not null,
tbeg DATE not null,
payload VARCHAR2(255),
vbeg date,
vend date,
tend timestamp not null,
status CHAR(1) not null,
primary key (businessKey, version)
)
where c_businessKey columns references C.businessKey.
The thing is C.businessKey is not unique.
What I would like to be able to do is to write a method on the object mapped to table B (let's call it BO) that would have a method getCByBusinessKey() that would return a list of CO where C.businessKey would be the one from B.c_businessKey.
I tried to map it as a list, but I does not work when I do the following for the mapping of B:
Code:
<list name="links" cascade="save-update">
<key>
<column name="c_businessKey"/>
</key>
<index column="version"/>
<one-to-many class="com.bnpparibas.power.model.C"/>
</list>
The problem comes from the fact that CO has a composite-key so the list defined in BO must have both columns defined in the key.
What am I missing there?