Annotations Lost for associations

Hi,

Lets say I have class A and B and have an association between them as OneToMany… Specifying properly Multiplicity on both sides I get perfectly correct result in Java generated code…

lets say (simplified)

class A {
ArrayList bClasses = new ArrayList();

getters setters
}

class B {
A owner;

getters setters
}

But then a problem comes. I need to specify an annotation for generated List in class A.
like

@OneToMany(mappedBy=“owner”)

Specification of association does not have and Annotations Tab, so as I can see only way to go to create a linked attribute in general tab of association specification, which really looks like a solution, BUT. if I create an attribute with same name as association end name I get in resulted code straight property without an array:

class A {
B bClasses;
}

class B{
A owner;
}

if I choose different name I obviously get 2 attributes in class A, one from association with proper array but without annotation and second from attribute with annotations.

class A {
ArrayList bClasses =…
@myannotation
B bClassesAttribute;
}

I tried to give up association and just specify multiplicity for an attribute. It appears that generated code not depending on that at all its always generated code like:
ClassType propery;

although I think if I choose multiplication 0…x it should generate me a List or something…

Pls advise,
Yuri

Hi Yuri,

Sorry for our late response. May I know you are using the Round-trip code engineering? Instant Generator? or the ORM code generation?

Best regards,
Rain Wong