1 2 Previous Next 16 Replies Latest reply on Mar 11, 2009 2:35 PM by asookazian

    workshop project: can't generate seam entities

    asookazian

      using JBDS 2.0.0.CR2

      So I'm following step-by-step the instructions here:

      http://docs.jboss.org/tools/3.0.0.CR2/en/GettingStartedGuide/html_single/index.html#reverse_engineer_crud after having completed this:
      http://docs.jboss.org/tools/3.0.0.CR2/en/GettingStartedGuide/html_single/index.html#first_seam

      The dev db is running after executing runDBServer.bat.

      I have a workshop and workshop-test project. No errors in the problems view.

      When I switch to Hibernate perspective, I see the workshop and configuration, session factory, Database underneath it in the Hibernate Configurations view.

      I try to revengr the tables (Customers, Employees, etc) via Seam Generate Entities wizard. I select (include) all the tables and click finish. NOTE: this is a JPA type config.

      Can't generate seam entities
       org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: org.domain.workshop.entity.Orderdetails with template view/edit.xhtml.ftl
       Error while processing Entity: org.domain.workshop.entity.Orderdetails with template view/edit.xhtml.ftl
       org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: org.domain.workshop.entity.Orderdetails with template view/edit.xhtml.ftl
       Error while processing Entity: org.domain.workshop.entity.Orderdetails with template view/edit.xhtml.ftl
       freemarker.template.TemplateException: Error executing macro: outputValue
      required parameter: property is not specified.
       Error executing macro: outputValue
      required parameter: property is not specified.


      What's the root cause and how to fix this??


        • 1. Re: workshop project: can't generate seam entities
          maxandersen

          There was a patch that did not make it into CR2;
          it is fixed in latest build.

          See https://jira.jboss.org/jira/browse/JBIDE-3880

          You can fix your installation by replacing "indentifier" with "identifier" in the seamfp/seam-gen/view/edit.xhtml.ftl.

          (You can see the full patch in JBIDE-3880)

          • 2. Re: workshop project: can't generate seam entities
            asookazian

            Ok thx! that worked, I have successfully revengr'd my entity classes.

            I am having the same problem as with my other project:

            "foo is not mapped"

            http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4217020#4217020

            The entity classes exist in src/main (org.domain.workshop.entity package).

            I rebuilt and refreshed the Hibernate Configuration for workshop (several times) and I am getting:

            Error
            Wed Mar 11 09:02:32 PDT 2009
            org.hibernate.hql.ast.QuerySyntaxException: Customers is not mapped [from Customers c]
            
            org.hibernate.hql.ast.QuerySyntaxException: Customers is not mapped [from Customers c]
             at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
             at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
             at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
             at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:255)
             at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
             at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
             at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
             at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
             at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
             at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
             at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
             at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
             at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
             at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
             at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
             at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
             at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
             at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
             at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
             at org.hibernate.console.HQLQueryPage.setSession(HQLQueryPage.java:106)
             at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:426)
             at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
             at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:421)
             at org.hibernate.eclipse.hqleditor.HQLEditor.executeQuery(HQLEditor.java:416)
             at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:73)
             at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:53)
             at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
             at org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:57)
             at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
             at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
             at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
             at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
             at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
             at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
             at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
             at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
             at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
             at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
             at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
             at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
             at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
             at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
             at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
             at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
             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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
             at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
             at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
            


            The classpath for the workshop configuration shows the workshop project folder (default classpath) under User Entries. When I exapnd that tree I see workshop folder which includes the newly gen'd entity classes.

            Why is this happening for this demo project?


            • 3. Re: workshop project: can't generate seam entities
              maxandersen

              so you got a *.class file in the classpath ?

              That sounds really weird ;(

              • 4. Re: workshop project: can't generate seam entities
                asookazian

                 

                "max.andersen@jboss.com" wrote:
                so you got a *.class file in the classpath ?(


                what are you talking about? not clear here. The classpath requires the source files for the entities or the bytecode?

                • 5. Re: workshop project: can't generate seam entities
                  asookazian

                  for edit config, should it work with the default classpath only in the classpath tab or not?

                  I removed the .class reference. I even add the entity source folder in the classpath (\workshop\src\main\org\domain\workshop\) and it's still not working....

                  • 6. Re: workshop project: can't generate seam entities
                    asookazian

                    looking back at the instructions doc:
                    http://docs.jboss.org/tools/3.0.0.CR2/en/GettingStartedGuide/html_single/index.html#create_seam_application

                    In Figure 3.5. Runtimes Selecting, note that there is no check for JPA 1.0. I don't believe I checked it so I have no JPA facet (not sure exactly what a facet is).

                    Does that have something to do with my situation?? Should I have checked it?

                    • 7. Re: workshop project: can't generate seam entities
                      asookazian

                      so I deleted the workshop projects and started over. this time I specified a JPA facet in addition to the defaults.

                      still doesn't work when I exec "from Customers" in HQL editor. Still getting "Customers is not mapped" error.

                      @Entity
                      @Table(name = "CUSTOMERS", schema = "PUBLIC")
                      public class Customers implements java.io.Serializable {
                      ...
                      }


                      Also, here: Figure 3.46. Mapping Diagram Opening, I can't do that either. When I click expand configuration, I don't see anything. so no mapping diagrams available either.

                      As per Table 4.3. Hibernate Console Configuration Classpath from this link: http://docs.jboss.org/tools/3.0.0.CR2/en/hibernatetools/html_single/index.html#console_conf

                      classpath: The classpath for loading POJO and JDBC drivers; only needed if the default classpath of the Project does not contain the required classes. Do not add Hibernate core libraries or dependencies, they are already included. If you get ClassNotFound errors then check this list for possible missing or redundant directories/jars.


                      I'm assuming that my default classpath contains the entity classes.

                      If it's this much a pain to setup basic tools in JBDS (and there isn't adequate coverage in docs on configurations with JPA), I won't even use it. I never had this many problems with MyEclipseIDE. I've spent almost 1.5 days getting this and the Seam Components view to work. I appreciate your help, but I don't consider Seam/JBDS "next-generation" development...

                      • 8. Re: workshop project: can't generate seam entities
                        asookazian

                        I also deleted the hibernate config and created a new one. still no luck.

                        • 9. Re: workshop project: can't generate seam entities
                          maxandersen

                          For the HQL to run we need the .class files.

                          asookazian - i'm sorry you are having problems but we are doing the exact same things you are doing every day in QA or development and I'm not able to reproduce it. The HQL editor works out of the box.

                          Could you do a screenshot of how your console configuration looks like ?

                          • 10. Re: workshop project: can't generate seam entities
                            asookazian

                            Max, I just emailed you a .swf video of my JBDS and Hibernate config/console, etc. I thought that would be easiest.

                            So it *IS* the bytecode that needs to be in the classpath entry for the classpath tab. Well, I just noticed that the .class files are not built immediately after I did a revengr. And I have no build.xml (that I have when I run seam setup and create-project in cmd line.

                            So this is most likely at least part of the problem (that the .class files for the entities don't exist (yet)) and that they need to be visible in the classpath.

                            • 11. Re: workshop project: can't generate seam entities
                              asookazian

                              I enabled "build automatically" from the project menu in JBDS and the .class files are not there.

                              the "from Customers" query now executed fine in HQL editor. sorry about the mixup.

                              There should be a note that the *.class files for the entity classes need to be available in your classpath. That would have avoided a lot of my headaches on this...

                              thx a lot for your consistent and helpful follow ups!!

                              now I need to determine how to get this working with my seam-gen'd project....

                              • 12. Re: workshop project: can't generate seam entities
                                asookazian

                                 

                                "asookazian" wrote:
                                I enabled "build automatically" from the project menu in JBDS and the .class files are not there.


                                sorry, I meant the .class files are NOW there.

                                can't they add an edit button to these damn forum!!??

                                • 13. Re: workshop project: can't generate seam entities
                                  maxandersen

                                  Great! Things made sense in the end.

                                  Any ide how the project auto build got disabled ?

                                  It is enabled by default in the installation (at least it should be)

                                  • 14. Re: workshop project: can't generate seam entities
                                    asookazian

                                     

                                    "max.andersen@jboss.com" wrote:
                                    Great! Things made sense in the end.

                                    Any ide how the project auto build got disabled ?

                                    It is enabled by default in the installation (at least it should be)


                                    I'm very sure I didn't manually do it via the JBDS IDE. It's possible that it was a preset config from an existing workspace that I used for my BETS project. I then created the maxTest and workshop projects in that same workspace.

                                    I have a feeling it's not a bug...

                                    1 2 Previous Next