Re: Problem with CompositionCycleException

Martin Matula <[email protected]> Thu, 22 Jul 2004 11:05:15 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi Matthias,
if this really happens, you are right that it is a bug. :)
It's strange that rollback does not work in this case since there are 
several rollback tests in JMI TCK and the memory storage passes them. 
(At least it did last time I checked.)
Please file a bug report and we will look at it. It would be very much 
appreciated if you could also attach your test to it (if that's 
possible) - it would make our debugging much easier.
Thanks,
Martin

Matthias Köster wrote:

> Hi,
>
> When i try to run a test like the following with the memory storage 
> implementation
>
> MDRepositoryCreator _creator;
>
> Model model = createModel();
> UmlPackage outerPackage = createUmlPackage();
> outerPackage.refSetValue("namespace", model);
> UmlPackage innerPackage = createUmlPackage();
> innerPackage.refSetValue("namespace", outerPackage);
>
> _creator.beginTransaction(true);
> try {
>  outerPackage.refSetValue("namespace", innerPackage);
>  _creator.getInstance().endTransaction(false);
>  fail("Expected CompositionCycleException!");
> }
> catch(CompositionCycleException e) {
>  _creator.getInstance().endTransaction(true);
> }
>
> assertSame(outerPackage.refImmediateComposite(), model);
>
> the test fails, but passes with the BTree storage. The example uses 
> the UML metamodel, but should be reproducible with other metamodels 
> that contain composite associations (the namespace association is a 
> composite in UML).
> To me this looks like a bug, since the rollback doesn't restore the 
> composite inside the StorableObject. As far as i understand this 
> problem at the moment, the problem doesn't occur with the Btree 
> storage since it will reinitialize the StorableObject from disk.  What 
> do you think?
>
> Regards,
> Matthias Köster
>
>