Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.2.0
-
Fix Version/s: 1.2.1
-
Component/s: DSL for Services
-
Labels:None
Description
Two domain classes that have a bidirectional many to many relationship cause a compiler error in the corresponding dto translator:
StdActieDtoTranslator.java: "The method getFromStdBesluiten(Long) is undefined for the type StdActie"
The models are as follows.
busmod
class StdActie [
string omschrijving
minlength 1 maxlength 100;
string toelichting
minlength 1 maxlength 4000;
boolean actief
default true;
rules [
"organisatie of reglandKaderOrgs gevuld" StdActieAssociatieControle;
]
]
association StdActie stdActies many -> one Organisatie organisatie;
association StdActie stdActies many -> one Kader kader;
class StdBesluit [
string omschrijving
minlength 1 maxlength 100;
string toelichting
minlength 1 maxlength 4000;
boolean actief
default true;
rules [
"organisatie of reglandKaderOrgs gevuld" StdBesluitAssociatieControle;
]
]
association StdBesluit stdBesluiten many <-> many StdActie stdActies;
association StdBesluit stdBesluiten many -> one Organisatie organisatie;
association StdBesluit stdBesluiten many -> one Kader kader;
And
dtcmod
class StdActieDto represents StdActie [
omschrijving;
toelichting;
actief;
references [
organisatie as OrganisatieDto;
stdBesluiten as StdBesluitDto;
]
]
class StdBesluitDto represents StdBesluit [
omschrijving;
toelichting;
actief;
references [
organisatie as OrganisatieDto;
stdActies as StdActieDto;
]
]
This generates the following in the dto translator:
StdActieDtoTranslator.java
public StdActie fromDto(final StdActieDto source, final StdActie target) throws TranslatorException { // other code here /* An existing object to be updated */ // compiler error here if (target.getFromStdBesluiten(element.getId()) == null) { // Element is not in target yet, read it from the store, update and add to target StdBesluit original = stdBesluitDao.retrieve(element .getId()); StdBesluit updated = stdBesluitDtoTranslator.fromDto( element, original); target.addToStdBesluiten(updated); } else { // Element is in target already, use this object and update it. No need to add to the collection // compiler error here stdBesluitDtoTranslator.fromDto(element, target .getFromStdBesluiten(element.getId())); }
Added additional code generation.