8 Replies Latest reply on Apr 15, 2010 7:42 AM by shane lee

    Problems with crud application generated using Seamgen

    Chris Malan Novice

      The application is the Seam in Action exploded war example.  I used JBoss 5.0.0.GA and Seam 2.1.0.SP1.  Everything works up to and including getting the generated home page in the browser.  There are some links at the top, mainly collections of entities and one log in link.  Logging in works fine.  However, clicking on any other link throws the following exceptions:

      javax.faces.FacesException: javax.el.ELException: /FacilityList.xhtml @99,61 rendered="#{empty facilityList.resultList}": Error reading 'resultList' on type org.open18.action.FacilityList_$$_javassist_4
      Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Facility is not mapped [select facility from Facility facility]

      I got it to work on another machine deploying the whole thing as an archived ear.  A war caused the same problems.  Spending a lot of time looking at the generated code was fruitless.

      This has been reported in early October.  See https://jira.jboss.org/jira/browse/JBSEAM-3501

      The last word on it was

      Pete Muir - 03/Oct/08 11:41 AM
      Stan, I can reproduce with any seam-gen project e.g. the release test database. I don't think this has anything to do with Seam, but is about how Hibernate is mapping entities in the WAR (they are mapped, but the query fails?!).

      Could you take a look?

      I could find nothing else on it.  This problem still seems to be alive and well and living with its parents, Seam and Hibernate.  Anyway to get past this?  I want to try out the hot deployment of code changes that come with an exploded war.

        • 1. Re: Problems with crud application generated using Seamgen
          Chris Malan Novice

          A quick update:  before going to work I quickly deployed the app to JBoss-4.2.2.GA.  No problems now.  Everything works as it should.

          The same Seam-2.1.0, the same code generated by Seam.  The finger points to JBoss-5.0.0.  What worked once does not work anymore.  If it ain't broken, forget about not fixing it, break it?  BTW, 4.2.2 starts 30 seconds faster than 5.0.0 on my system - Gentoo Linux, Sun JDK 1.6, 2MB Ram.

          • 2. Re: Problems with crud application generated using Seamgen
            Björn Raupach Newbie

            Any updates on that subject? Is there a fix for JBoss AS 5.0.0 ?

            • 3. Re: Problems with crud application generated using Seamgen
              Oguzhan YALCIN Newbie

              Hi, In another topic someone mentioned same error. I2ve faced with this error on jboss as 5.0. I think the problem is with the jndi and persistencecontext. You can jump over this exception by simply adding your entities into the persistence.xml file like


              Persitence.xml is under your src/main/META-INF folder.

              • 4. Re: Problems with crud application generated using Seamgen
                Chris Malan Novice

                Hi Oguzhan,

                Thanks.  This worked perfectly. 

                Chris Malan

                • 5. Re: Problems with crud application generated using Seamgen
                  Nicolas Doye Newbie

                  On JBossAS 5.1.0.GA with Seam 2.1.2, this fix doesn't work. :-(

                  (I'm using Sun Java 1.6.0_12 on 32-bit Vista).

                  Anyone any idea?

                     <persistence-unit name="cron" transaction-type="JTA">
                           <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                           <property name="hibernate.hbm2ddl.auto" value="create"/>
                           <property name="hibernate.show_sql" value="true"/>
                           <property name="hibernate.format_sql" value="true"/>
                           <property name="hibernate.default_schema" value="nems"/>
                           <!-- Only relevant if Seam is loading the persistence unit (Java SE bootstrap) -->
                           <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>

                  Yet I still get:

                  Caused by: org.hibernate.hql.ast.QuerySyntaxException: Dbcron is not mapped [select dbcron from Dbcron dbcron]

                  This is making a mockery of getting seam up and running quickly :-(


                  • 6. Re: Problems with crud application generated using Seamgen
                    Chris Malan Novice

                    Hi Nic,

                    Try removing the transaction-type="JTA">  See if that makes any difference. Your last property seems to indicate the hibernate transaction manager.  I don't have that line
                    (<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>), either.


                    • 7. Re: Problems with crud application generated using Seamgen
                      Vrxy  Newbie

                      I tried adding this <class>org.domain.oneseamproj.entity.Orgperson</class> into the persistence.xml but I still get the error:

                      Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Orgperson is not mapped [select orgperson from Orgperson orgperson]

                      I tried the one suggested by Chris, removing the <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> from the file. But still, I get that error.

                      I'm using BossAS 5.1.0.GA with Seam 2.2.0.GA.

                      Please help me solve this. Thanks in advance! :)
                      • 8. Re: Problems with crud application generated using Seamgen
                        shane lee Newbie

                        I found this problem too on jboss 5.1.0.GA and using seam 2.2 when deploying dan allens seam in action example.

                        He explains the problem here:

                        So in web.xml i added element persistence-unit-ref:


                        and in components.xml

                         <persistence:managed-persistence-context  name="entityManager"

                        removing attribute entity-manager-factory.

                        Deployed again and this exception did not occur.