To implement the fix described below, you'll have to run "appfuse:copy- templates" and then modify the appropriate .ftl file in the imported templates.

Matt

On Feb 9, 2009, at 5:24 PM, Ice-Man wrote:


    Matt (or all other forks),

  I couldn't find this issue in APF/JIRA. :o
 Plz, could u point it to me or even a temporary solution for the isse
(join / foreing key)??!
 Anyway, could u point me to a tut./quickGuide to fix up Foreing
Annotations?!!
 In advance, thnx,

Ice-Man



mraible wrote:

On Thu, Nov 6, 2008 at 7:28 AM, mwaynewalter
<wayne.wal...@abc.virginia.gov> wrote:

Matt,

Thanks but I found a fix.  FYI, the error below says this is the
offending
line.

${pojo.generateJoinColumnsAnnotation(property)} [on line 11, column 15 in

If works beautifully if you add a parameter to that method so it looks
like
this in appfuse/model/Ejb3PropertyGetAnnotation.ftl:

${pojo.generateJoinColumnsAnnotation(property,cfg)}

In the newer version of hibernate tools, that method needs the
configuration
as the second argument.

If you simply put ",cfg" there, it will fix it.

Wow. It took me about 4 hours to figure this out.

Thanks for taking the time to figure this out. Can you please enter an
issue in JIRA so we can solve it for the next release?

http://issues.appfuse.org/browse/APF


Please any advice? Do people really use this gen-model tool heavily? I
see
a number of "to do" comments in the code. Is there a more powerful,
better
recommended reverse engineering tool for JPA/ hibernate?

The gen-model plugin re-uses a lot of what the Hibernate3 Maven Plugin
does, but adds some AppFuse-specific tweaks.

Matt


The appfuse:gen seems to work better.

Wayne


mraible wrote:

On Wed, Nov 5, 2008 at 2:34 PM, mwaynewalter
<wayne.wal...@abc.virginia.gov> wrote:

With appfuse 2.0.2 for struts basic and hibernate, I get the error
below
(with stack trace) when running appfuse:gen-model This is an Oracle
10g
database.

appfuse:gen-model works like a charm on any individual table or tables
without inter-dependencies.

But as soon as you include any two tables with a foreign key
relationship,
this error happens.

We are aware of this issue and don't have a solution currently.

Matt


hibernate.reveng.xml is setup as recommended in JIRA and the Wiki for
Oracle
already.

The Oracle foreign key relationship looks like this (an excerpt)...

"INVESTIGATINGAGENT" NUMBER(8,0),
FOREIGN KEY ("INVESTIGATINGAGENT")
        REFERENCES "COREDBA"."EMPLOYEE" ("EMPLOYEEID") ENABLE

And the employeeid looks like this:

"EMPLOYEEID" NUMBER(8,0) NOT NULL ENABLE,

I scoured the internet in a vain attempt to find some guidance already
out
there.
Please help.

16:20:42,257 ERROR freemarker.runtime -
Method public java.lang.String
org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.gen
erateJoinColumnsAnnotation (org.hibernate.mapping.Property,org.hibernate.cfg.Conf
iguration) threw an exception when invoked on
org.hibernate.tool.hbm2x.pojo.Enti
tyPOJOClass(gov.virginia.abc.model.License)
The problematic instruction:
----------
in include "Ejb3PropertyGetAnnotation.ftl" [on line 1, column 1 in
appfuse/mode
l/GetPropertyAnnotation.ftl]
in include "GetPropertyAnnotation.ftl" [on line 9, column 5 in
appfuse/model/Po
joPropertyAccessors.ftl]
in include "PojoPropertyAccessors.ftl" [on line 9, column 1 in
appfuse/model/Po
jo.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Method public
java.lang.String
org.h
ibernate .tool .hbm2x .pojo.EntityPOJOClass.generateJoinColumnsAnnotation(org.hiber
nate.mapping.Property,org.hibernate.cfg.Configuration) threw an
exception
when i
nvoked on
org .hibernate .tool.hbm2x.pojo.EntityPOJOClass(gov.virginia.abc.model.L
icense)
      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.j
ava: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(GenericExport
er.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(DefaultPluginManage
r.java:579)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFail
ures(DefaultLifecycleExecutor.java:498)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForPro
ject(DefaultLifecycleExecutor.java:265)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(Defa
ultLifecycleExecutor.java:191)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:149)
      at
org .apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java: 223)
      at
org .apache .maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:3
04)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java: 1)
      at
org .apache .maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.ja
va:904)
      at
org .apache .maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbe
dder.java:304)
      at
org .apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
Caused by: java.lang.IllegalArgumentException: wrong number of
arguments
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
sun .reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
      at
sun .reflect .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java: 616)
      at
freemarker .ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
      ... 70 more
Exception in thread "main" org.hibernate.tool.hbm2x.ExporterException:
Error
whi
le processing template appfuse/model/Pojo.ftl
      at
org .hibernate .tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:
257)
      at
org .hibernate .tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.j
ava: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(GenericExport
er.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(DefaultPluginManage
r.java:579)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFail
ures(DefaultLifecycleExecutor.java:498)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForPro
ject(DefaultLifecycleExecutor.java:265)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(Defa
ultLifecycleExecutor.java:191)
      at
org .apache .maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:149)
      at
org .apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java: 223)
      at
org .apache .maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:3
04)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java: 1)
      at
org .apache .maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.ja
va:904)
      at
org .apache .maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbe
dder.java:304)
      at
org .apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
Caused by: freemarker.template.TemplateModelException: Method public
java.lang.S
tring
org .hibernate .tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotatio n (org.hibernate.mapping.Property,org.hibernate.cfg.Configuration) threw
an
excep
tion when invoked on
org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(gov.virginia.
abc.model.License)
      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)
      ... 24 more
Caused by: java.lang.IllegalArgumentException: wrong number of
arguments
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
sun .reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
      at
sun .reflect .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java: 616)
      at
freemarker .ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
      ... 70 more
--
View this message in context:
http://www.nabble.com/appfuse-2.0.2-gen-model-and-join-columns--tp20349030s2369p20349030.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net




--
View this message in context:
http://www.nabble.com/appfuse-2.0.2-gen-model-and-join-columns--tp20349030s2369p20362066.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net




--
View this message in context: 
http://www.nabble.com/appfuse-2.0.2-gen-model-and-join-columns--tp20349030s2369p21925223.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to