To reproduce this I would need not only the relationship specification but also some real initial data. Could you please provide it? Thanks.
I have an example project. It contains the source, dataset, and exploded EAR. It is a self-contained, zipped Eclipse project. How can I send it to you?
Question: When I look at the getIdList() method of the RelationSet class in package org.jboss.ejb.plugins.cmp.jdbc.bridge, I see the exception is thrown when setHandle is null. IF this is a list of my D entites, then is the exception thrown because I have no D entities (In my example, I remove the D entities before the parant C entity)? If so, how can I remove a C entity?
As requested here is the sample dataset using Hypersonic SQL:
create table TABLE_A ( TABLE_A_ID VARCHAR(2) not null, VALUE_A1 VARCHAR(16), primary key (TABLE_A_ID) ); create table TABLE_B ( TABLE_B_ID VARCHAR(2) not null, TABLE_A_ID VARCHAR(2), VALUE_B1 VARCHAR(8), primary key (TABLE_B_ID) ); create table TABLE_C ( TABLE_C_ID VARCHAR(2) not null, TABLE_A_ID VARCHAR(2), VALUE_C1 VARCHAR(8), primary key (TABLE_C_ID) ); create table TABLE_D ( TABLE_D_ID VARCHAR(2) not null, TABLE_C_ID VARCHAR(2), VALUE_D1 VARCHAR(8), primary key (TABLE_D_ID) ); alter table TABLE_B add constraint TABLE_B_FK1 foreign key (TABLE_A_ID) references TABLE_A; alter table TABLE_C add constraint TABLE_C_FK1 foreign key (TABLE_A_ID) references TABLE_A; alter table TABLE_D add constraint TABLE_D_FK1 foreign key (TABLE_C_ID) references TABLE_C; insert into TABLE_A values ('a1', 'value_a1'); insert into TABLE_B values ('b1', 'a1', 'value_b1'); insert into TABLE_B values ('b2', 'a1', 'value_b2'); insert into TABLE_C values ('c1', 'a1', 'value_c1'); insert into TABLE_C values ('c2', 'a1', 'value_c2'); insert into TABLE_D values ('d1', 'c1', 'value_d1'); insert into TABLE_D values ('d2', 'c2', 'value_d2'); insert into TABLE_D values ('d3', 'c2', 'value_d3');
What is the method code that fails? So far it works for me with these relationships and the data.
If you have a testcase you can submit a bug report on sf.net/projects/jboss. Thanks.
According to Specs.
10.3.6.1 Use of the java.util.Collection API to Update Relationships
The Bean Provider should exercise caution when using an Iterator over a collection in a container-managed relationship. In particular, the Bean Provider should not modify the container-managed collection while the iteration is in progress in any way that causes elements to be added or removed, other than by the java.util.Iterator.remove() method. If elements are added or removed from the underlying container-managed collection used by an iterator other than by the java.util.Iterator.
remove() method, the container should throw the java.lang.IllegalStateException on the next operation on the iterator.
I would suggest for CMR collections, if you want to modify them while iterating around, make a copy of the CMR Collection and then modify it.