8 Replies Latest reply on Jul 9, 2002 5:53 AM by ukkm

    JBossCMP 3.0 - Wrong table mapping

    ukkm

      Hi there,

      I'm working with JBoss 3.0. My small project is based on CMP and I could successfully deploy it. Now in the test I get an error in the findByPrimaryKey method which looks a little strange for me.

      2002-07-03 20:33:05,275 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.UserEJB.findByPrimaryKey] Executing SQL: SELECT userId FROM userejb WHERE userId=?
      2002-07-03 20:33:05,430 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.UserEJB.findByPrimaryKey] Find failed
      java.sql.SQLException: ERROR: Relation 'userejb' does not exist

      at org.postgresql.Connection.ExecSQL(Connection.java:533)
      at org.postgresql.jdbc2.Statement.execute(Statement.java:294)
      at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:59)
      at org.postgresql.jdbc2.PreparedStatement.executeQuery(PreparedStatement.java:108)
      at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeQuery(LocalPreparedStatement.java:289)

      The problem what I can recognize is that the generated SELECT statement uses the wrong table name 'userejb'. In the jbosscmp-jdbc.xml file I have specified the right table name:

      <entity>
      <ejb-name>UserEJB</ejb-name>
      <table-name>t_users</table-name>
      . . .
      </entity>

      So I have no idea what the actual problem is. Any hints are welcome.

      Thanks in advance
      Udo

        • 1. Re: JBossCMP 3.0 - Wrong table mapping
          dsundstrom

          This is weird. Does the server.log file say that it loaded your jbosscmp-jdbc.xml file? If not, run "jar -tf your_jar_file.jar" and make sure there is an entry for "META-INF/jbosscmp-jdbc.xml" capitalization counts.

          • 2. Re: JBossCMP 3.0 - Wrong table mapping
            ukkm

            Thanks for your quick reply. Here are the two lines from the server log saying something about the jbosscmp-jdbc.xml file

            2002-07-03 20:32:37,776 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.CustomerEJB] Loading standardjbosscmp-jdbc.xml : file:/opt/jboss-3.0.0_tomcat-4.0.3/server/default/conf/standardjbosscmp-jdbc.xml
            2002-07-03 20:32:38,227 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.CustomerEJB] jar:njar:file:/opt/jboss-3.0.0_tomcat-4.0.3/server/default/tmp/deploy/server/default/deploy/CoCoEJB.ear/79.CoCoEJB.ear^/CoCoEJB.jar!/META-INF/jbosscmp-jdbc.xml found. Overriding defaults

            And here a snip of the content from my jar file.
            META-INF/
            META-INF/MANIFEST.MF
            META-INF/ejb-jar.xml
            META-INF/jboss.xml
            META-INF/jbosscmp-jdbc.xml
            coco/
            coco/base/
            coco/base/CocoAppException.class
            coco/base/CocoSysException.class
            ...

            • 3. Re: JBossCMP 3.0 - Wrong table mapping
              ukkm

              Hi Dain,

              thanks for your quick reply. This is my second try to post this reply. I hope it won't be redundant. Here are the two lines from the server.log file saying somthing about the jbosscmp-jdbc.xml file:

              2002-07-03 20:32:37,776 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.CustomerEJB] Loading standardjbosscmp-jdbc.xml : file:/opt/jboss-3.0.0_tomcat-4.0.3/server/default/conf/standardjbosscmp-jdbc.xml
              2002-07-03 20:32:38,227 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.CustomerEJB] jar:njar:file:/opt/jboss-3.0.0_tomcat-4.0.3/server/default/tmp/deploy/server/default/deploy/CoCoEJB.ear/79.CoCoEJB.ear^/CoCoEJB.jar!/META-INF/jbosscmp-jdbc.xml found. Overriding defaults

              And here is a snip from the CoCoEJB.jar listing:

              META-INF/
              META-INF/MANIFEST.MF
              META-INF/ejb-jar.xml
              META-INF/jboss.xml
              META-INF/jbosscmp-jdbc.xml
              coco/
              coco/base/
              coco/base/CocoAppException.class
              coco/base/CocoSysException.class
              ...

              I can't see any specials.

              Regards
              Udo

              Regards
              Udo

              • 4. Re: JBossCMP 3.0 - Wrong table mapping
                dsundstrom

                It all looks correct to me. Can you post a bug report at source forge a long with a small testcase that reproduced the problem?

                • 5. Re: JBossCMP 3.0 - Wrong table mapping
                  zeeshanarif

                  I am having the same problem.. so if any body finds the solution, please update.

                  Thanks,

                  Zeeshan

                  • 6. Re: JBossCMP 3.0 - Wrong table mapping
                    zeeshanarif

                    Found the solution to this problem.

                    The configuration depends on which CMP version you are using. It also depends on the version of Jboss you are using. I have used CMP1.0 and Jboss3.0.0 with jaws.

                    For CMP2.0, you need to have the doctype definitions set properly. I was not able to do it. I think I need a lot more documentation to set it properly + CMP2.0 EJB concepts.

                    I hope it helps.

                    • 7. Re: JBossCMP 3.0 - Wrong table mapping
                      dsundstrom

                      You can buy the JBossCMP documentation at FlashLine for $10. Just search for JBoss at www.flashline.com

                      • 8. Re: JBossCMP 3.0 - Wrong table mapping
                        ukkm

                        Hi there,

                        thanks for your reply. I'm using JBoss 3.0 with CMP 2.0. This is accordingly specified in my ejb-jar.xml following the DTD for EJB 2.0

                        <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

                        Every tag has a subtag <cmp-version>2.x</cmp-version>. So I think that an application server should be able to properly interprete my deployment descriptors.

                        I believe that is a problem for a JBoss developer and how I know Dain Sundstrom is already working on it. I hope to get a solution from him very soon.

                        Best regards
                        Udo