jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Mod4j: Modeling for Java using Domain Specific Languages
  • MODFORJ-209

Invalid dto translator generated for bidirectional many to many association

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor 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()));
				}

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jos Warmer added a comment - 01/Apr/10 12:32 PM

Added additional code generation.

Show
Jos Warmer added a comment - 01/Apr/10 12:32 PM Added additional code generation.

People

  • Assignee:
    Jos Warmer
    Reporter:
    Jeroen Nijs
Vote (0)
Watch (0)

Dates

  • Created:
    31/Mar/10 5:23 AM
    Updated:
    01/Apr/10 12:32 PM
    Resolved:
    01/Apr/10 12:32 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.