Hi Sean,
I'm still wondering what happens at your side as I use n:m mappings
myself without problems. There are 3 things you can try:
1. What happens if you remove the required="true" attribute form
jpComponent.colProducts and jpProduct.colComponents?
2. Try to specify get-method="getColProducts" and
set-method="setColProducts" for jpComponent.colProducts as well as
get-method="getColComponents" and set-method="setColComponents" for
jpProduct.colComponents.
3. Try to change your set methods according the following example.
public void setColComponents(ArrayList list) {
colComponents = new ArrayList(list);
}
In addition you can send me that part of your code that modifies the
objects as described in your first mail.
>Create another Product (Product Y)
>Create Component C - no problem.
>Add Component C to Product Y - no problem
>Add Component B to Product Y - problem!
Having said that if this does not help the last chance to find the
problem will be a test case.
Regards
Ralf
Sean McDonald schrieb:
Ralf Joachim wrote:
Hi Sean,
your mapping seam to be OK.
Which methods to access the colComponents property in jpProduct have
you implemented (get/set/add) and how do they look like?
How do the failing part of code looks like where you add Component B
to Produkt Y?
Regards
Ralf
Hi Ralf
Sorry that it has taken so long to get back to you.
Here are the methods in jpProduct that control get/set/add actions.
public ArrayList getColComponents() {
return colComponents;
}
public void setColComponents(ArrayList list) {
colComponents = list;
}
public Object getColComponents(int index){
Object o = colComponents.get(index);
return o;
}
public boolean addColComponents(Object o){
jpComponent thisComponent = (jpComponent) o;
if(colComponents.contains(thisComponent)==false){
thisComponent.addColProducts(this);
return colComponents.add(thisComponent);
} else {
return false;
}
}
The problem is, that once I add the component to a particular product,
and update them both, Castor takes it upon itself to delete all
references to the component in other products. This is an extremely
puzzling behaviour.
Many thanks in advance for any insight you can offer.
Have a better day
Sean
-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message
to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
--
Syscon Ingenieurb�ro f�r
Me�- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstra�e 11
D-72127 Kusterdingen
Germany
Tel. +49 7071 3690 52
Mobil: +49 173 9630135
Fax +49 7071 3690 98
Email: [EMAIL PROTECTED]
Web: www.syscon-world.de
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------