What steps will reproduce the problem?
1. Generate the following model into Java
class Ranged {
1 -- 0..4 Relation1;
}
class One {
1 -- 1 Relation1;
}
class Relation1{}
2.
There is a method "addRelation1" will be created in "Ranged" class to allow us
to pass in "One" parameter instead of "Relation1" parameter, and then it can
internally construct an instance of Relation1 and reference it to the current
Ranged instance. This seems fine at the beginning; however, creating an
instance of "One" means that we already defined the one-to-one relation to that
instance, which means that this one object already has its one-to-one relation
to another Relation1 object. Therefore, invoking the constructor call "new
Relation1(this, aOne)" will always throw an exception as the "One" object
already has its Relation1 boundary.
What is the expected output? What do you see instead?
An option to resolve this issue is by making sure that we expand the method
parameters instead and call for the other constructor that will create the one
object internally. This means that instead of having the method parameters to
be as:
public boolean addRelation1(One aOne)
It will be:
public boolean addRelation1(Ranged aRangedForRelation1)
Then in the method implementation, we will be calling for:
new Relation1(this, aRangedForRelation1)
This means that Relation1 will use the other constructor that will internally
create an internal "One" instance and bound it with the current "Ranged" and
"Relation1" instances that we are dealing with in addRelation1 invocation.
Please use labels and text to provide additional information.
N/A
Original issue reported on code.google.com by ahmedvc@gmail.com on 21 Jun 2013 at 2:29
Original issue reported on code.google.com by
ahmedvc@gmail.com
on 21 Jun 2013 at 2:29