6 Replies Latest reply on Aug 30, 2002 12:18 PM by Dain Sundstrom

    Could not create entity

    Darko Mulej Newbie

      Hi!

      I have very persistent problem regarding creating new CMP Entity Bean. With JBoss-3.0.0-RC2-Tomcat-4.0.3 & DB2 7.1 (or 7.2, not sure) and debug option turned on in standardjaws.xml I got this message:

      2002-05-20 17:33:58,016 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Polica] Executing SQL: INSERT INTO DB2ADMIN.ZDR_POLICA_NEW (id_police, id_org_en, dat_kon_zav, id_tur_agen, tp_frekvenca, id_sklic, id_del, tp_pol_sektor, id_podj, pol_prem_sit, tp_program, pol_zav_vsota, pol_dopl, st_napake, pol_str_asist, st_napake_opis, pol_prem_dem, pol_dat_agen, pol_dni, user_id, pol_dat_asist, pol_dat_storno, pol_str_beta, tp_obl_zav, zdr_provizija, pol_zvsota_zsp, pol_dat_skl, id_poslovalnica, tp_cenik, st_zdr, pol_stat_psl, pol_sifra_pog, tp_obmocje, pol_kraj, pol_plcrnja, pol_prem_skup, pol_stev_zav, pol_prem_placana, pol_str_alfa, pol_prem_davek, pol_dat_kart, dat_zac_zav, ts_dat) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      2002-05-20 17:33:58,176 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Polica] Could not create entity
      COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0301N The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type. SQLSTATE=07006

      at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:263)
      at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:206)
      at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:445)
      at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java:1666)
      at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(DB2PreparedStatement.java:1230)
      at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeUpdate(LocalPreparedStatement.java:308)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(JDBCCreateEntityCommand.java:196)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:131)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:444)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:253)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:231)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:728)
      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:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1116)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:230)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:176)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:134)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.Container.invoke(Container.java:727)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy36.create(Unknown Source)
      at si.zav_triglav.zz.ejb.PolicaSFBean.createPolica(Unknown Source)
      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:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:147)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:706)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy29.createPolica(Unknown Source)
      at si.zav_triglav.zz.usecase.PolicaBD.createPolica(Unknown Source)
      at si.zav_triglav.zz.webapp.action.EditEvidencaAction.perform(Unknown Source)
      at org.apache.struts.action.Action.execute(Action.java:369)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:437)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:264)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
      at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
      at java.lang.Thread.run(Thread.java:536)
      2002-05-20 17:33:58,426 INFO [STDOUT] ex in PolicaSF.create() - 2javax.ejb.CreateException: Could not create entity:COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0301N The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type. SQLSTATE=07006


      And btw, I have no problem with the other bean in the same database.
      Any ideas? Thanks in advance.

      Darko

        • 1. Re: Could not create entity
          Brian Macy Newbie

          Was there a resolution to this? I'm getting the exact same problem.

          • 2. Re: Could not create entity
            Ben Wong Newbie

            Darko,

            I may be wrong, but I am guessing by the error messages, that you have a field whose data type is not compatible with DB2. It would be helpful if you show us the ejb-jar.xml and jbosscmp-jdbc.xml files.

            Ben

            • 3. Re: Could not create entity
              David Li Newbie

              I am also have the same problem.

              Following is the information on the error. thx for the help in advance.

              Server: JBoss 3.0.1

              Following is the error msg I got when I try to access a entity bean. Just to be note: other similar bean works fine, just this one have problem.

              COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0301N The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type. SQLSTATE=07006

              at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:260)
              at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:197)
              at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:448)
              at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java:1247)
              at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(DB2PreparedStatement.java:807)

              Following is my ejb-jar.xml, please note that I am using my own key class.


              <ejb-name>MDLabProcedureSource</ejb-name>
              skeva.engage.md.labs.model.MDLabProcedureSourceHome
              skeva.engage.md.labs.model.MDLabProcedureSource
              <ejb-class>skeva.engage.md.labs.model.MDLabProcedureSourceBean</ejb-class>
              <persistence-type>Container</persistence-type>
              <prim-key-class>skeva.engage.md.labs.model.MDLabProcedureSourceKey</prim-key-class>
              False
              <cmp-field id="MDLabProcedureSource_procedureSource">
              <field-name>procedureSource</field-name>
              </cmp-field>
              <cmp-field id="MDLabProcedureSource_description">
              <field-name>description</field-name>
              </cmp-field>
              <cmp-field id="MDLabProcedureSource_max_length">
              <field-name>max_length</field-name>
              </cmp-field>


              and the follwoing is my jaws.xml file.

              <ejb-name>MDLabProcedureSource</ejb-name>
              <create-table>false</create-table>
              <table-name>EML_PROC_SRCE</table-name>
              <remove-table>false</remove-table>
              <tuned-updates>false</tuned-updates>
              <read-only>false</read-only>
              <time-out>600</time-out>
              <cmp-field>
              <field-name>description</field-name>
              <column-name>SOURCE_DESCRIPTION</column-name>
              </cmp-field>
              <cmp-field>
              <field-name>procedureSource</field-name>
              <column-name>PROCEDURE_SOURCE</column-name>
              </cmp-field>
              <cmp-field>
              <field-name>max_length</field-name>
              <column-name>MAX_LENGTH</column-name>
              </cmp-field>


              and the my standarjbosscmp-jdbc.xml file is remain the same as when I got the package.

              Any hints or helps will be thankful. thanx in advance.

              David

              • 4. Re: Could not create entity
                Dain Sundstrom Master

                You are using JBossCMP not JAWS, and this means you use the jbosscmp-jdbc.xml file instead of the jaws.xml file. My guess is you have not changed the datasource-mapping to IBM DB2 in the jbosscmp-jdbc.xml file and you are therefore trying to use a jdbc-type or sql-type not supported by DB2.

                • 5. Re: Could not create entity
                  David Li Newbie

                  Hi Dain, how are you? Thx for the reply.

                  I am stil consider as very new to JBoss, especically JBoss 3.0.1. I am not sure where is the jbosscmp-jdbc.xml file, but I leave the standardjbosscmp-jdbc.xml alone as it is in the JBoss 3.0.1 package-the /conf directory. As you see on my last posting, for my application, I have created jaws.xml and ejb-jar.xml file to map my entity beans and session beans. Since my application need to communicate with two database, db2 and oracle, I changed the default datasouce in standardjaws.xml to oracle. So, Dain, I am not sure what you meant that I am using jbosscmp-jdbc.xml file instead of jaws.xml file, but I will try to read more about it. I have the advance documents, but it doesn't help me that much. It will be greatful if you can tell me more about datasource mapping to IBM DB2 in teh jbosscmp-jdbc.xml file. More importantly, details on jbosscmp-jdbc.xml

                  My progress with the investigation through the eclipse debugger is that I found my Key class return me the correct value, but when I try to get the entity using the findByPrimaryKey method with the Key class object, I got a null, and then I got the db2exception of sqlstate=07006. Please let me know more hints or helps. Thx in advance.

                  David Li

                  • 6. Re: Could not create entity
                    Dain Sundstrom Master

                    Start by reading the Quick Start Guide.

                    The problem you are having is you keep editing and createing jaws fiels. If you see jaws in the name of a file, JBossCMP does not use it anymore. JAWS is old stuff.

                    Read the Quick Start Guide and it will help you setup the jbosscmp-jdbc.xml file.