2 Replies Latest reply on Mar 22, 2013 10:40 AM by magick93

    suggestions on how to use EMF domain models in Errai

    magick93

      Hi

       

      I have several domain models developed using EMF for GWT (http://wiki.eclipse.org/EMF/GWT).

       

      I'm interested to hear on how best to use these in Errai?

       

      Ive been trying marshalling using the ErraiApp.properties file - but the best I can get is "org.jboss.errai.marshalling.client.api.exceptions.InvalidMappingException: there is no custom mapping or default no-arg constructor"

       

      It would be fantastic if there is a way to leverage our existing emf domain in errai

        • 1. Re: suggestions on how to use EMF domain models in Errai
          jfuerth

          I'm not familiar with the EMF for GWT project, but it sounds like the model classes it generates don't include a no-arg constructor. Errai supports three scenarios for marshallable objects:

           

          1. Java classes that include a no-arg constructor, which need not be public (the class can have other constructors in addition to the no-arg one)
          2. Java classes that have a constructor with each argument annotated with @MapsTo. Again, the constructor does not need to be public.
          3. Java classes with a static factory method, each argument annotated with @MapsTo

           

          If you can't modify the model objects, and you can't convince EMF to satisfy one of the above scenarios, you will have to resort to writing custom mappings.

           

          All of the above is covered in the Marshalling chapter of the Errai Reference Guide: https://docs.jboss.org/author/display/ERRAI/Marshalling

           

          Good luck,

          Jonathan

          • 2. Re: suggestions on how to use EMF domain models in Errai
            magick93

            I am looking at using EMF with Acceleo, as this means I can design templates and fairly freely map EMF to whatever template design.

             

            I will let you know how it goes.