FAQ
There appears to be an issue either with class generation or something with
my model.

Whenever I have a relationship that crosses datanodes the TargetEntity is
null. So I get things like in the Java class:

public static final Property<$importUtils.formatJavaType(${rel.TargetEntity.
ClassName})> COMPANY = new Property<$importUtils.formatJavaType(${rel
.TargetEntity.ClassName})>("company");

If the entity is with the same datanode I don't have an issue (same line in
the velocity template).

Any ideas?

Thanks,

Lon

Search Discussions

  • Mike Kienenberger at Oct 29, 2014 at 12:24 am
    Back in Cayenne 1.2/2.0, there was a way to specify additional
    datamaps in cgen. Maybe that's what's missing for you now, although
    I don't know for certain.
    On Tue, Oct 28, 2014 at 7:59 PM, Lon Varscsak wrote:
    There appears to be an issue either with class generation or something with
    my model.

    Whenever I have a relationship that crosses datanodes the TargetEntity is
    null. So I get things like in the Java class:

    public static final Property<$importUtils.formatJavaType(${rel.TargetEntity.
    ClassName})> COMPANY = new Property<$importUtils.formatJavaType(${rel
    .TargetEntity.ClassName})>("company");

    If the entity is with the same datanode I don't have an issue (same line in
    the velocity template).

    Any ideas?

    Thanks,

    Lon
  • Andrus Adamchik at Oct 29, 2014 at 6:21 am
    Try using "additionalMaps" parameter:

    http://cayenne.apache.org/docs/3.1/cayenne-guide/including-cayenne-in-project.html#maven-projects

    "additionalMaps [...] A directory that contains additional DataMap XML files that may be needed to resolve cross-DataMap relationships for the the main DataMap, for which class generation occurs."

    On a side note, I don't recall why we initially went with per-DataMap instead of per-project "cgen", but now I feel like cgen should read cayenne-project.xml and discover all this information on its own. Until we change this approach, "additionalMaps" should help.

    HTH,
    Andrus
    On Oct 29, 2014, at 2:59 AM, Lon Varscsak wrote:

    There appears to be an issue either with class generation or something with
    my model.

    Whenever I have a relationship that crosses datanodes the TargetEntity is
    null. So I get things like in the Java class:

    public static final Property<$importUtils.formatJavaType(${rel.TargetEntity.
    ClassName})> COMPANY = new Property<$importUtils.formatJavaType(${rel
    .TargetEntity.ClassName})>("company");

    If the entity is with the same datanode I don't have an issue (same line in
    the velocity template).

    Any ideas?

    Thanks,

    Lon
  • Lon Varscsak at Oct 29, 2014 at 4:45 pm
    I agree on the project.xml idea...makes a lot of sense.

    Okay, on additionalMaps I was trying this yesterday and couldn't get it to
    work. I've provided the directory to where my datamap files are stored and
    I see that it fails (although I don't have any detail...not sure how to see
    that in m2e). I've tried the full path, trailing slashes, no trailing
    slashes, etc.

    I'm probably being dense...but just not sure how. :D

    -Lon

    On Tue, Oct 28, 2014 at 11:19 PM, Andrus Adamchik wrote:

    Try using "additionalMaps" parameter:


    http://cayenne.apache.org/docs/3.1/cayenne-guide/including-cayenne-in-project.html#maven-projects

    "additionalMaps [...] A directory that contains additional DataMap XML
    files that may be needed to resolve cross-DataMap relationships for the the
    main DataMap, for which class generation occurs."

    On a side note, I don't recall why we initially went with per-DataMap
    instead of per-project "cgen", but now I feel like cgen should read
    cayenne-project.xml and discover all this information on its own. Until we
    change this approach, "additionalMaps" should help.

    HTH,
    Andrus
    On Oct 29, 2014, at 2:59 AM, Lon Varscsak wrote:

    There appears to be an issue either with class generation or something with
    my model.

    Whenever I have a relationship that crosses datanodes the TargetEntity is
    null. So I get things like in the Java class:

    public static final
    Property<$importUtils.formatJavaType(${rel.TargetEntity.
    ClassName})> COMPANY = new Property<$importUtils.formatJavaType(${rel
    .TargetEntity.ClassName})>("company");

    If the entity is with the same datanode I don't have an issue (same line in
    the velocity template).

    Any ideas?

    Thanks,

    Lon
  • Lon Varscsak at Oct 29, 2014 at 9:13 pm
    Below is my plugin section for reference, but when I have the
    additionalMaps section, I get this error:

    [ERROR] Failed to execute goal
    org.apache.cayenne.plugins:maven-cayenne-plugin:3.2M1:cgen (production) on
    project shbusinesslogic: Error generating classes: [v.3.2M1 Jul 07 2013
    16:23:58] Error loading DataMap, last processed tag: <null>:
    /Users/varscsak/Development/git/smarthealth/tapestry/libraries/SHCayenneBusinessLogic/cayenne-model.xml
    (No such file or directory) -> [Help 1]

    But the cayenne-model.xml is no where in that directory...not sure why it's
    trying to look there.

    <plugin>

    <groupId>org.apache.cayenne.plugins</groupId>

    <artifactId>maven-cayenne-plugin</artifactId>

         <!-- shared config part -->

         <configuration>

    <destDir>${project.build.sourceDirectory}</destDir>

    <template>${basedir}/supporting/subclass.vm</template>

    <superTemplate>${basedir}/supporting/superclass.vm</superTemplate>

             <additionalMaps>${project.build.sourceDirectory}/../resources/</
    additionalMaps>

         </configuration>

      <executions>

    <execution>

                 <id>production</id>

                 <!-- Per execution config -->

                 <configuration>

    <map>${project.build.sourceDirectory}/../resources/production.map.xml</map>

                 </configuration>

                 <goals>

                     <goal>cgen</goal>

                 </goals>

    </execution>

    <execution>

                 <id>marketing</id>

                 <!-- Per execution config -->

                 <configuration>

    <map>${project.build.sourceDirectory}/../resources/marketing.map.xml</map>

                 </configuration>

                 <goals>

                     <goal>cgen</goal>

                 </goals>

    </execution>

    <execution>

                 <id>customer</id>

                 <!-- Per execution config -->

                 <configuration>

    <map>${project.build.sourceDirectory}/../resources/customer.map.xml</map>

                 </configuration>

                 <goals>

                     <goal>cgen</goal>

                 </goals>

    </execution>

    <execution>

                 <id>personalization</id>

                 <!-- Per execution config -->

                 <configuration>

    <map>${project.build.sourceDirectory}/../resources/personalization.map.xml</
    map>

                 </configuration>

                 <goals>

                     <goal>cgen</goal>

                 </goals>

    </execution>

    </executions>

    </plugin>

    On Wed, Oct 29, 2014 at 9:45 AM, Lon Varscsak wrote:

    I agree on the project.xml idea...makes a lot of sense.

    Okay, on additionalMaps I was trying this yesterday and couldn't get it
    to work. I've provided the directory to where my datamap files are stored
    and I see that it fails (although I don't have any detail...not sure how to
    see that in m2e). I've tried the full path, trailing slashes, no trailing
    slashes, etc.

    I'm probably being dense...but just not sure how. :D

    -Lon

    On Tue, Oct 28, 2014 at 11:19 PM, Andrus Adamchik wrote:

    Try using "additionalMaps" parameter:


    http://cayenne.apache.org/docs/3.1/cayenne-guide/including-cayenne-in-project.html#maven-projects

    "additionalMaps [...] A directory that contains additional DataMap XML
    files that may be needed to resolve cross-DataMap relationships for the the
    main DataMap, for which class generation occurs."

    On a side note, I don't recall why we initially went with per-DataMap
    instead of per-project "cgen", but now I feel like cgen should read
    cayenne-project.xml and discover all this information on its own. Until we
    change this approach, "additionalMaps" should help.

    HTH,
    Andrus
    On Oct 29, 2014, at 2:59 AM, Lon Varscsak <lon.varscsak@gmail.com> wrote:
    There appears to be an issue either with class generation or something with
    my model.

    Whenever I have a relationship that crosses datanodes the TargetEntity is
    null. So I get things like in the Java class:

    public static final
    Property<$importUtils.formatJavaType(${rel.TargetEntity.
    ClassName})> COMPANY = new Property<$importUtils.formatJavaType(${rel
    .TargetEntity.ClassName})>("company");

    If the entity is with the same datanode I don't have an issue (same line in
    the velocity template).

    Any ideas?

    Thanks,

    Lon

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedOct 29, '14 at 12:01a
activeOct 29, '14 at 9:13p
posts5
users3
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase