This is likely because AMP doesn't support relationships very well. If
you remove your relationships from your POJO, you may be able to
generate successfully. Another option, available in 2.0.1-SNAPSHOT, is
you can override/customize the web/jsf/form-view.ftl in your project
and fix the issue.

Matt

On 12/19/07, JinBinWang <[EMAIL PROTECTED]> wrote:
>
> mraible:
>   Hi~Thanks for your repondence.
>   I am using the latest AppFuse2.0.1 version and maven2.0.7.
>   I don't know whether it's just the AMP or whether there's something
> inherently wrong with my entity structure.
>
>
> mraible wrote:
> >
> > What version of AppFuse/AMP are you using?
> >
> > Matt
> >
> > On 12/19/07, JinBinWang <[EMAIL PROTECTED]> wrote:
> >>
> >> This seems as though it would be a common problem but I haven't found
> >> much
> >> information on the forum.
> >> I create two entitys like this:
> >> SUPERCLASS:
> >> @Entity
> >> @Table(name="emp_table")
> >> @Inheritance(strategy=InheritanceType.JOINED)
> >> public class Employee implements Serializable {
> >>         private static final long serialVersionUID = 48L;
> >>
> >>         private Long id;
> >>
> >>         private String name;
> >>
> >>         private String pass;
> >>
> >>         private double salary;
> >>
> >>         private Manager manager;
> >>
> >>         private Set<Attend> attends = new HashSet<Attend>();
> >>
> >>         private Set<Payment> payments = new HashSet<Payment>();
> >>
> >>         @OneToMany(mappedBy="id")
> >>         public Set<Attend> getAttends() {
> >>                 return attends;
> >>         }
> >>
> >>         public void setAttends(Set<Attend> attends) {
> >>                 this.attends = attends;
> >>         }
> >>
> >>         @Id @GeneratedValue(strategy=GenerationType.AUTO)
> >>         @Column(name="emp_id")
> >>         public Long getId() {
> >>                 return id;
> >>         }
> >>
> >>         public void setId(Long id) {
> >>                 this.id = id;
> >>         }
> >>
> >>         @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE
> >> },fetch=FetchType.EAGER)
> >>         @JoinColumn(name = "mgr_id")
> >>         public Manager getManager() {
> >>                 return manager;
> >>         }
> >>
> >>         public void setManager(Manager manager) {
> >>                 this.manager = manager;
> >>         }
> >>
> >>         @Column(name="emp_name")
> >>         public String getName() {
> >>                 return name;
> >>         }
> >>
> >>         public void setName(String name) {
> >>                 this.name = name;
> >>         }
> >>
> >>         @Column(name="emp_pass")
> >>         public String getPass() {
> >>                 return pass;
> >>         }
> >>
> >>         public void setPass(String pass) {
> >>                 this.pass = pass;
> >>         }
> >>
> >>         @OneToMany(mappedBy="id")
> >>         public Set<Payment> getPayments() {
> >>                 return payments;
> >>         }
> >>
> >>         public void setPayments(Set<Payment> payments) {
> >>                 this.payments = payments;
> >>         }
> >>
> >>         @Column(name="emp_salary")
> >>         public double getSalary() {
> >>                 return salary;
> >>         }
> >>
> >>         public void setSalary(double salary) {
> >>                 this.salary = salary;
> >>         }
> >>
> >>         public Employee() {
> >>         }
> >>
> >>         public Employee(Long id, String name, String pass, double salary,
> >>                         Manager manager) {
> >>                 this.id = id;
> >>                 this.name = name;
> >>                 this.pass = pass;
> >>                 this.salary = salary;
> >>                 this.manager = manager;
> >>         }
> >>
> >>         public boolean equals (Object obj)
> >>     {
> >>                 if (null == obj) return false;
> >>                 if (!(obj instanceof Employee))
> >>         {
> >>             return false;
> >>         }
> >>                 else
> >>         {
> >>                         Employee employee = (Employee) obj;
> >>                         if (null == this.getName() || null ==
> >> employee.getName() )
> >>             {
> >>                 return false;
> >>             }
> >>                         else
> >>             {
> >>                 return (this.getName().equals(employee.getName()));
> >>             }
> >>                 }
> >>         }
> >>
> >>         public int hashCode ()
> >>     {
> >>                 return name.hashCode();
> >>         }
> >>
> >>         public String toString () {
> >>                 return super.toString();
> >>         }
> >> }
> >> SUBCLASS:
> >> @Entity
> >> @Table(name = "mgr_table")
> >> @PrimaryKeyJoinColumn(name = "mgr_id")
> >> public class Manager extends Employee implements Serializable {
> >>         private static final long serialVersionUID = 48L;
> >>
> >>         private String dept;
> >>
> >>         private Set<Employee> employees = new HashSet<Employee>();
> >>
> >>         private Set<CheckBack> checks = new HashSet<CheckBack>();
> >>
> >>         public Manager() {
> >>         }
> >>
> >>         public Manager(String dept) {
> >>                 this.dept = dept;
> >>         }
> >>
> >>         @OneToMany(mappedBy = "id")
> >>         public Set<CheckBack> getChecks() {
> >>                 return checks;
> >>         }
> >>
> >>         public void setChecks(Set<CheckBack> checks) {
> >>                 this.checks = checks;
> >>         }
> >>
> >>         @Column(name = "dept_name", nullable = false, length = 50)
> >>         public String getDept() {
> >>                 return dept;
> >>         }
> >>
> >>         public void setDept(String dept) {
> >>                 this.dept = dept;
> >>         }
> >>
> >>         @OneToMany(mappedBy = "id")
> >>         public Set<Employee> getEmployees() {
> >>                 return employees;
> >>         }
> >>
> >>         public void setEmployees(Set<Employee> employees) {
> >>                 this.employees = employees;
> >>         }
> >> }
> >> ------------------
> >> I receive the error indication like this when I execute the command "mvn
> >> appfuse:gen -Dentity=Manager":
> > D:\Program Files\eclipse\workspace\myworkflow>mvn appfuse:gen
> > -Dentity=Manager
> > [INFO] Scanning for projects...
> > [INFO] Searching repository for plugin with prefix: 'appfuse'.
> > [INFO] org.apache.maven.plugins: checking for updates from appfuse
> > [INFO] org.codehaus.mojo: checking for updates from appfuse
> > [INFO]
> > -------------------------------------------------------------------------
> > ---
> > [INFO] Building Personal WorkFlow System
> > [INFO]    task-segment: [appfuse:gen]
> > [INFO]
> > -------------------------------------------------------------------------
> > ---
> > [INFO] Preparing appfuse:gen
> > [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking
> > for updates from appfuse
> > [INFO] [aspectj:compile {execution: default}]
> > [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}]
> > [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}]
> > [INFO] [resources:resources]
> > [INFO] Using default encoding to copy filtered resources.
> > [INFO] [compiler:compile]
> > [INFO] Nothing to compile - all classes are up to date
> > [INFO] [appfuse:gen]
> > [INFO] Configuration XML file loaded: D:\Program
> > Files\eclipse\workspace\myworkflow\src\main\resources\hibernate.cfg.xml
> > [INFO] Configuration XML file loaded: D:\Program
> > Files\eclipse\workspace\myworkflow\src\main\resources\hibernate.cfg.xml
> > [INFO] src/main/resources/database.properties not found within the
> > project. Trying absolute path.
> > [INFO] No hibernate properties file loaded.
> > ERROR [main] runtime.error(96) |
> > Expression idFieldName is undefined on line 78, column 78 in
> > appfuse/web/jsf/form-view.ftl.
> > The problematic instruction:
> > ----------
> > ==> ${idFieldName} [on line 78, column 76 in
> > appfuse/web/jsf/form-view.ftl]
> > ----------
> >
> > Java backtrace for programmers:
> > ----------
> > freemarker.core.InvalidReferenceException: Expression idFieldName is
> > undefined o
> > n line 78, column 78 in appfuse/web/jsf/form-view.ftl.
> >         at
> > freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
> >
> >         at freemarker.core.Expression.getStringValue(Expression.java:118)
> >         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.Environment.process(Environment.java:176)
> >         at freemarker.template.Template.process(Template.java:231)
> >         at
> > org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
> > r.java:247)
> >         at
> > org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro
> > ducer.java:67)
> >         at
> > org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
> > va:28)
> >         at
> > org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
> > va:97)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
> > ava:146)
> >         at
> > org.appfuse.tool.AppFuseExporter$1.exportPOJO(AppFuseExporter.java:21
> > 4)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
> > cExporter.java:135)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.ja
> > va:41)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
> > :126)
> >         at
> > org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
> > :95)
> >         at
> > org.appfuse.tool.AppFuseExporter.generateWeb(AppFuseExporter.java:126
> > )
> >         at
> > org.appfuse.tool.AppFuseExporter.doStart(AppFuseExporter.java:50)
> >         at
> > org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
> > :95)
> >         at
> > org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMoj
> > o.java:228)
> >         at
> > org.appfuse.mojo.exporter.AppFuseGeneratorMojo.doExecute(AppFuseGener
> > atorMojo.java:241)
> >         at
> > org.appfuse.mojo.HibernateExporterMojo.execute(HibernateExporterMojo.
> > java:138)
> >         at
> > org.appfuse.mojo.exporter.AppFuseGeneratorMojo.execute(AppFuseGenerat
> > orMojo.java:194)
> >         at
> > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
> > nManager.java:443)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
> > ultLifecycleExecutor.java:539)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
> > Goal(DefaultLifecycleExecutor.java:493)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
> > ltLifecycleExecutor.java:463)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
> > dleFailures(DefaultLifecycleExecutor.java:311)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
> > ts(DefaultLifecycleExecutor.java:278)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
> > fecycleExecutor.java:143)
> >         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
> >         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
> >         at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> > java:39)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> > sorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:585)
> >         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)
> > [INFO]
> > ------------------------------------------------------------------------
> > [ERROR] FATAL ERROR
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Error while processing template appfuse/web/jsf/form-view.ftl
> > Expression idFieldName is undefined on line 78, column 78 in
> > appfuse/web/jsf/for
> > m-view.ftl.
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Trace
> > org.hibernate.tool.hbm2x.ExporterException: Error while processing
> > template appf
> > use/web/jsf/form-view.ftl
> >         at
> > org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
> > r.java:253)
> >         at
> > org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro
> > ducer.java:67)
> >         at
> > org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
> > va:28)
> >         at
> > org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
> > va:97)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
> > ava:146)
> >         at
> > org.appfuse.tool.AppFuseExporter$1.exportPOJO(AppFuseExporter.java:21
> > 4)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
> > cExporter.java:135)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.ja
> > va:41)
> >         at
> > org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
> > :126)
> >         at
> > org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
> > :95)
> >         at
> > org.appfuse.tool.AppFuseExporter.generateWeb(AppFuseExporter.java:126
> > )
> >         at
> > org.appfuse.tool.AppFuseExporter.doStart(AppFuseExporter.java:50)
> >         at
> > org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
> > :95)
> >         at
> > org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMoj
> > o.java:228)
> >         at
> > org.appfuse.mojo.exporter.AppFuseGeneratorMojo.doExecute(AppFuseGener
> > atorMojo.java:241)
> >         at
> > org.appfuse.mojo.HibernateExporterMojo.execute(HibernateExporterMojo.
> > java:138)
> >         at
> > org.appfuse.mojo.exporter.AppFuseGeneratorMojo.execute(AppFuseGenerat
> > orMojo.java:194)
> >         at
> > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
> > nManager.java:443)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
> > ultLifecycleExecutor.java:539)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
> > Goal(DefaultLifecycleExecutor.java:493)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
> > ltLifecycleExecutor.java:463)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
> > dleFailures(DefaultLifecycleExecutor.java:311)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
> > ts(DefaultLifecycleExecutor.java:278)
> >         at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
> > fecycleExecutor.java:143)
> >         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
> >         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
> >         at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> > java:39)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> > sorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:585)
> >         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.core.InvalidReferenceException: Expression
> > idFieldName is
> > undefined on line 78, column 78 in appfuse/web/jsf/form-view.ftl.
> >         at
> > freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
> >
> >         at freemarker.core.Expression.getStringValue(Expression.java:118)
> >         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.Environment.process(Environment.java:176)
> >         at freemarker.template.Template.process(Template.java:231)
> >         at
> > org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
> > r.java:247)
> >         ... 34 more
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Total time: 58 seconds
> > [INFO] Finished at: Thu Dec 20 11:28:38 CST 2007
> > [INFO] Final Memory: 16M/29M
> > [INFO]
> > ------------------------------------------------------------------------
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Cannt-using-gen-command-in-AppFuse-tp14414609s2369p14430534.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to