AppFuse
  1. AppFuse
  2. APF-1152

mvn appfuse:gen-model with a db that as a table with a FK doesn't work

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Hi everybody,

      I'm very newbie here with AppFuse but its potential was something that could not deviate my attention.
      Congratulations Matt & all the members for such a good work.

      Ok, now something I was trying and went wrong ...
      When trying reverse engineer from a mysql db that has a table with a foreign key, I received the error(exception) below.
      I did check for other issues in JIRA but I didn't find anything related to this, but maybe there is something already related.
      ________________________________________________________________________________________
      bruno@bruno-laptop:~/workspace/appfuse/myproject/core$ mvn appfuse:gen-model
      Warning: JAVA_HOME environment variable is not set.
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Building AppFuse Modular Application - Core
      [INFO] task-segment: [appfuse:gen-model]
      [INFO] ------------------------------------------------------------------------
      [INFO] Preparing appfuse:gen-model
      [INFO] [aspectj:compile

      {execution: default}

      ]
      [INFO] [resources:resources]
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 5 resources
      [INFO] [appfuse:gen-model]
      [INFO] Configuration XML file loaded: file:/home/bruno/workspace/appfuse/myproject/core/src/main/resources/hibernate.cfg.xml
      [INFO] Configuration Properties file loaded: /home/bruno/workspace/appfuse/myproject/core/target/test-classes/jdbc.properties
      20:14:57,541 ERROR freemarker.runtime -
      Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotation(org.hibernate.mapping.Property,org.hibernate.cfg.Configuration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.mycompany.app.model.Game)
      The problematic instruction:
      ----------
      ==> $

      {pojo.generateJoinColumnsAnnotation(property)}

      [on line 11, column 15 in appfuse/model/Ejb3PropertyGetAnnotation.ftl]
      in include "Ejb3PropertyGetAnnotation.ftl" [on line 1, column 1 in appfuse/model/GetPropertyAnnotation.ftl]
      in include "GetPropertyAnnotation.ftl" [on line 9, column 5 in appfuse/model/PojoPropertyAccessors.ftl]
      in include "PojoPropertyAccessors.ftl" [on line 9, column 1 in appfuse/model/Pojo.ftl]
      ----------

      Java backtrace for programmers:
      ----------
      freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotation(org.hibernate.mapping.Property,org.hibernate.cfg.Configuration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.mycompany.app.model.Game)
      at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
      at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
      at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
      at freemarker.core.Expression.getStringValue(Expression.java:93)
      at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IfBlock.accept(IfBlock.java:82)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.include(Environment.java:1375)
      at freemarker.core.Include.accept(Include.java:155)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.include(Environment.java:1375)
      at freemarker.core.Include.accept(Include.java:155)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
      at freemarker.core.Environment.visit(Environment.java:351)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.include(Environment.java:1375)
      at freemarker.core.Include.accept(Include.java:155)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IfBlock.accept(IfBlock.java:82)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.visit(Environment.java:233)
      at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.process(Environment.java:176)
      at freemarker.template.Template.process(Template.java:232)
      at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
      at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
      at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
      at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
      at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
      at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:135)
      at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:41)
      at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
      at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
      at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:228)
      at org.appfuse.mojo.exporter.ModelGeneratorMojo.execute(ModelGeneratorMojo.java:183)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: java.lang.IllegalArgumentException: wrong number of arguments
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
      at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
      ... 74 more
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error while processing template appfuse/model/Pojo.ftl
      wrong number of arguments
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.hibernate.tool.hbm2x.ExporterException: Error while processing template appfuse/model/Pojo.ftl
      at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:257)
      at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
      at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
      at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
      at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
      at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:135)
      at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:41)
      at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
      at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
      at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:228)
      at org.appfuse.mojo.exporter.ModelGeneratorMojo.execute(ModelGeneratorMojo.java:183)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotation(org.hibernate.mapping.Property,org.hibernate.cfg.Configuration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.mycompany.app.model.Game)
      at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
      at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
      at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
      at freemarker.core.Expression.getStringValue(Expression.java:93)
      at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IfBlock.accept(IfBlock.java:82)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.include(Environment.java:1375)
      at freemarker.core.Include.accept(Include.java:155)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.include(Environment.java:1375)
      at freemarker.core.Include.accept(Include.java:155)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
      at freemarker.core.Environment.visit(Environment.java:351)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.include(Environment.java:1375)
      at freemarker.core.Include.accept(Include.java:155)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IfBlock.accept(IfBlock.java:82)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.visit(Environment.java:233)
      at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.process(Environment.java:176)
      at freemarker.template.Template.process(Template.java:232)
      at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
      ... 28 more
      Caused by: java.lang.IllegalArgumentException: wrong number of arguments
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
      at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
      ... 74 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 4 seconds
      [INFO] Finished at: Wed May 06 20:14:57 CEST 2009
      [INFO] Final Memory: 31M/475M
      [INFO] ------------------------------------------------------------------------

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Matt Raible
            Reporter:
            Bruno de Almeida
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development