cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Remove association

nimind
Champ in-the-making
Champ in-the-making
hi,

i´m trying to remove an association using this method:

private void removeAssociations(Reference referFrom,Reference referTo,String type)throws Exception {
   
   Predicate predFrom = new Predicate(new Reference[]{referFrom},STORE,null);
   
   
    Predicate predTo = new Predicate(new Reference[]{referTo},STORE,null);
  
   
   CMLRemoveAssociation rmas = new CMLRemoveAssociation(predFrom,null,predTo,null,type);
   CML cml = new CML();
   cml.setRemoveAssociation(new CMLRemoveAssociation[]{rmas});
   UpdateResult[] r =  WebServiceFactory.getRepositoryService().update(cml);
   
}


Any exception was thrown and the association was not removed

Do i need to do something more?

thanks
2 REPLIES 2

doblek
Champ in-the-making
Champ in-the-making
Hi,

that sounds like there is a problem with the CMLRemoveAssociation object… =/

Predicate objects seem to be ok, so I would bet that the problem is the association string (which is the "type" parameter in your method)… Maybe you have to use a proper qname for the association you want to remove…

I've never used this command though  Smiley Surprisedops: so I could be wrong… But I have a similar problem with similar commands and, as far as I can remember, the problem was that I was using a bad assoc-name… Take a look to that 😃

Hope that helps.

Regards,
Enrique

nimind
Champ in-the-making
Champ in-the-making
Hi,

thanks for your answer, this was just my problem. The type was not correct.