5 Replies Latest reply on Feb 25, 2005 6:37 AM by Jarva Jarva

    No such entity WHY?

    Jarva Jarva Newbie

      Hi!!!
      When i try to execute "findByPrimaryKey" on my CMP bean, i've this exception:

      javax.ejb.ObjectNotFoundException: No such entity!
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:50)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:589)
       at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:298)
       at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
       at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
       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.invocation.Invocation.performCall(Invocation.java:345)
       at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
       at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
       at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:192)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:212)
       at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
       at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:117)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:126)
       at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:101)
       at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
       at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
       at org.jboss.ejb.Container.invoke(Container.java:891)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:342)
       at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
       at $Proxy135.findByPrimaryKey(Unknown Source)
       at com.acotelsa.qnecta.server.dao.cliente.ejb.DAOCliente.actualizarBalanceEntity(DAOCliente.java:190)
       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.invocation.Invocation.performCall(Invocation.java:345)
       at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
       at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:123)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
       at org.jboss.ejb.Container.invoke(Container.java:870)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
       at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
       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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
       at sun.rmi.transport.Transport$1.run(Transport.java:148)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
       at java.lang.Thread.run(Thread.java:534)
      


      My java code, specially primary key, is like that (with Xdoclet):
      public abstract class DAOEntityBalance implements EntityBean {
      
       /**
       * El contexto de la sesión del EJB
       */
       private EntityContext context;
      
       /**
       * @ejb.interface-method view-type = "both"
       * @ejb.persistence column-name = "ID_CLIENTE" jdbc-type = "NUMERIC"
       * @ejb.pk-field
       */
       public abstract Long getIdCliente();
       /**
       * @ejb.interface-method view-type = "both"
       */
       public abstract void setIdCliente(Long idCliente);
      
       /**
       * @ejb.interface-method view-type = "both"
       * @ejb.persistence column-name = "BALANCE"
      ......


      Ejb-jar.xml:
      <entity >
       <description><![CDATA[DAOEntityBalance EJB]]></description>
       <display-name>DAOEntityBalance</display-name>
      
       <ejb-name>DAOEntityBalance</ejb-name>
      
       <home>com.acotelsa.qnecta.server.dao.balance.entity.DAOEntityBalanceHome</home>
       <remote>com.acotelsa.qnecta.server.dao.balance.entity.DAOEntityBalanceRemote</remote>
       <local-home>com.acotelsa.qnecta.server.dao.balance.entity.DAOEntityBalanceLocalHome</local-home>
       <local>com.acotelsa.qnecta.server.dao.balance.entity.DAOEntityBalanceLocal</local>
      
       <ejb-class>com.acotelsa.qnecta.server.dao.balance.entity.DAOEntityBalance</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>java.lang.Long</prim-key-class>
       <reentrant>false</reentrant>
       <cmp-version>2.x</cmp-version>
       <abstract-schema-name>TF_BALANCE</abstract-schema-name>
       <cmp-field >
       <description><![CDATA[]]></description>
       <field-name>idCliente</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[]]></description>
       <field-name>balance</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[]]></description>
       <field-name>credito</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[]]></description>
       <field-name>limite</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[]]></description>
       <field-name>controlLimite</field-name>
       </cmp-field>
       <primkey-field>idCliente</primkey-field>
      
       <env-entry>
       <env-entry-name>/qnecta/bbdd/jdbc/debugSQL</env-entry-name>
       <env-entry-type>java.lang.Boolean</env-entry-type>
       <env-entry-value><![CDATA[true]]></env-entry-value>
       </env-entry>
      
       <resource-ref >
       <res-ref-name>/qnecta/bbdd/jdbc/OracleDS_QPLANES</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
       </entity>

      Jboss.xml:
      <entity>
       <ejb-name>DAOEntityBalance</ejb-name>
       <jndi-name>/qnecta/ejb/DAOEntityBalanceHome</jndi-name>
       <local-jndi-name>/qnecta/ejb/DAOEntityBalanceLocalHome</local-jndi-name>
       <resource-ref>
       <res-ref-name>/qnecta/bbdd/jdbc/OracleDS_QPLANES</res-ref-name>
       <jndi-name>/qnecta/bbdd/jdbc/OracleDS_QPLANES</jndi-name>
       </resource-ref>
      
       <method-attributes>
       </method-attributes>
      
       </entity>

      And jbosscmp-jdbc.xml:
      <entity>
       <ejb-name>DAOEntityBalance</ejb-name>
      
       <table-name>TF_BALANCE</table-name>
      
       <cmp-field>
       <field-name>idCliente</field-name>
       <column-name>ID_CLIENTE</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>balance</field-name>
       <column-name>BALANCE</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>credito</field-name>
       <column-name>CREDITO</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>limite</field-name>
       <column-name>LIMITE</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>controlLimite</field-name>
       <column-name>CONTROL_LIMITE</column-name>
      
       </cmp-field>
      
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>


      Why have i this exception??? i try to use another key name, but it doesn't run. What is wrong, i can't find it!

      Thanks. Best regards.

        • 1. Re: No such entity WHY?
          Johan Borchers Newbie

          Hello,

          I don't see the java code that is calling findByPrimaryKey(???).
          I would think that you are passing a non existing primary key.
          You can enable CMP logging in the log4j.xml by setting:

           <category name="org.jboss.ejb.plugins.cmp">
           <priority value="TRACE" class="org.jboss.logging.XLevel"/>
           </category>
          


          Then you can see in the server log which value is passed as a parameter.

          Johan.

          • 2. Re: No such entity WHY?
            Jarva Jarva Newbie

            Thanks Johan.
            The findByPrimaryKey method is autogenerated by Xdoclet, it isn't implemented.
            I have turn on the CMP logging, and this is the exception now:

            12:16:43,750 DEBUG [DAOCliente] actualizarBalanceEntity=118112
            12:16:43,750 DEBUG [DAOEntityBalance#findByPrimaryKey] Executing SQL: SELECT t0_DAOEntityBalance.ID_CLIENTE FROM TF_BALANCE t0_DAOEntityBalance WHERE t0_DAOEntityBalance.ID_CLIENTE=?
            12:16:43,750 TRACE [DAOEntityBalance#findByPrimaryKey] param: i=1, type=INTEGER, value=118112
            12:16:43,750 INFO [STDOUT] javax.ejb.ObjectNotFoundException: No such entity!
            12:16:43,750 INFO [STDOUT] at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:50)
            12:16:43,750 INFO [STDOUT] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:589)
            12:16:43,750 INFO [STDOUT] at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
            12:16:43,750 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:298)
            12:16:43,750 INFO [STDOUT] at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
            12:16:43,750 INFO [STDOUT] at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
            12:16:43,750 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            12:16:43,750 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            12:16:43,750 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            12:16:43,765 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
            12:16:43,765 INFO [STDOUT] at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:192)
            12:16:43,765 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:212)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:117)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:126)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:101)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:891)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:342)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
            12:16:43,765 INFO [STDOUT] at $Proxy59.findByPrimaryKey(Unknown Source)
            12:16:43,765 INFO [STDOUT] at com.acotelsa.qnecta.server.dao.cliente.ejb.DAOCliente.actualizarBalanceEntity(DAOCliente.java:267)
            12:16:43,765 INFO [STDOUT] at com.acotelsa.qnecta.server.dao.cliente.ejb.DAOCliente.actualizarBalance(DAOCliente.java:170)
            12:16:43,765 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            12:16:43,765 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            12:16:43,765 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            12:16:43,765 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
            12:16:43,765 INFO [STDOUT] at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
            12:16:43,765 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:123)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
            12:16:43,765 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:870)
            12:16:43,765 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            12:16:43,765 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            12:16:43,765 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            12:16:43,765 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
            12:16:43,765 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
            12:16:43,765 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            12:16:43,765 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
            12:16:43,765 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
            12:16:43,765 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
            12:16:43,765 INFO [STDOUT] at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
            12:16:43,765 INFO [STDOUT] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
            12:16:43,765 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            12:16:43,765 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            12:16:43,765 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            12:16:43,765 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
            12:16:43,765 INFO [STDOUT] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
            12:16:43,765 INFO [STDOUT] at sun.rmi.transport.Transport$1.run(Transport.java:148)
            12:16:43,765 INFO [STDOUT] at java.security.AccessController.doPrivileged(Native Method)
            12:16:43,765 INFO [STDOUT] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
            12:16:43,781 INFO [STDOUT] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
            12:16:43,781 INFO [STDOUT] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
            12:16:43,781 INFO [STDOUT] at java.lang.Thread.run(Thread.java:534)


            I don't understand, because i'm sure that this row is on database. But i've also already tried to create this, and i've this exception:
            12:22:48,375 DEBUG [DAOCliente] actualizarBalanceEntity=118112
            12:22:48,375 DEBUG [DAOEntityBalance#findByPrimaryKey] Executing SQL: SELECT t0_DAOEntityBalance.ID_CLIENTE FROM TF_BALANCE t0_DAOEntityBalance WHERE t0_DAOEntityBalance.ID_CLIENTE=?
            12:22:48,375 TRACE [DAOEntityBalance#findByPrimaryKey] param: i=1, type=INTEGER, value=118112
            12:22:48,375 INFO [DAOCliente] No encuentra el balance. Se procede a crearle
            12:22:48,375 DEBUG [DAOEntityBalance$Proxy] Entra en create
            12:22:48,375 TRACE [DAOEntityBalance#idCliente] param: i=1, type=INTEGER, value=118112
            12:22:48,375 TRACE [DAOEntityBalance#idCliente] param: i=1, type=INTEGER, value=118112
            12:22:48,375 TRACE [DAOEntityBalance#balance] param: i=2, type=DOUBLE, value=0.0
            12:22:48,375 TRACE [DAOEntityBalance#credito] param: i=3, type=DOUBLE, value=0.0
            12:22:48,375 TRACE [DAOEntityBalance#limite] param: i=4, type=DOUBLE, value=500.0
            12:22:48,375 TRACE [DAOEntityBalance#controlLimite] param: i=5, type=VARCHAR, value=S
            12:22:48,375 DEBUG [DAOEntityBalance$Proxy] Entra en PostCreate
            12:22:48,375 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract void com.acotelsa.qnecta.server.dao.cliente.ejb.DAOClienteRemote.actualizarBalance(long,double) throws java.rmi.RemoteException, causedBy:
            org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=Miriam/21, BranchQual=, localId=21] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field accessor, or ejbSelect method: methodName=ejbStore)
             at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:344)
             at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:454)
             at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:322)
             at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
             at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:123)
             at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
             at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
             at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
             at org.jboss.ejb.Container.invoke(Container.java:870)
             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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
             at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
             at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
             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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
             at sun.rmi.transport.Transport$1.run(Transport.java:148)
             at java.security.AccessController.doPrivileged(Native Method)
             at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
             at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
             at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
             at java.lang.Thread.run(Thread.java:534)
            Caused by: javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field accessor, or ejbSelect method: methodName=ejbStore
             at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:83)
             at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:62)
             at com.acotelsa.qnecta.server.dao.balance.entity.DAOEntityBalance$Proxy.ejbStore(<generated>)
             at org.jboss.ejb.plugins.CMPPersistenceManager.ejbStore(CMPPersistenceManager.java:536)
             at org.jboss.ejb.plugins.CMPPersistenceManager.invokeEjbStore(CMPPersistenceManager.java:430)
             at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeEjbStore(CachedConnectionInterceptor.java:412)
             at org.jboss.ejb.EntityContainer.invokeEjbStore(EntityContainer.java:729)
             at org.jboss.ejb.GlobalTxEntityMap$2.invokeEjbStore(GlobalTxEntityMap.java:117)
             at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:239)
             at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.beforeCompletion(GlobalTxEntityMap.java:302)
             at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1383)
             at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1075)
             at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:296)
             ... 30 more


            i don't understand what happen....

            • 3. Re: No such entity WHY?
              Luca Stancapiano Apprentice

              hi jarva....the DAOClienteRemote.actualizarBalance(long,double) method where is declared and what is its role? it seems that that method use a wrong field or it 's not well declared. May I to see it?

              • 4. Re: No such entity WHY?
                Jarva Jarva Newbie

                Yeah, you can!!!

                This is the method you talk about:

                public void actualizarBalance(long idCliente, double importe)
                 {
                 //Se actualiza con la parte Entity
                 actualizarBalanceEntity(new Integer(""+idCliente),importe);
                 }

                which call to:
                private void actualizarBalanceEntity(Integer idCliente, double importe)
                 {
                 if (LogUtil.esDebug(this.getClass()))
                 LogUtil.debug("actualizarBalanceEntity="+idCliente,this.getClass());
                
                 double balance=0;
                 double limite=0;
                 double credito=0;
                
                 try{
                 try{
                 balanceLocal=balanceLocalHome.findByPrimaryKey(idCliente);
                 //Se lee el valor del campo BALANCE, CREDITO y LIMITE en BBDD
                 balance=balanceLocal.getBalance().doubleValue();
                 limite=balanceLocal.getLimite().doubleValue();
                 credito=balanceLocal.getCredito().doubleValue();
                 //Se comprueba que la actualización vaya a ser correcta
                 balance=balance+importe;
                 if ((credito+balance)<=limite)
                 {
                 //Se actualizan los datos en BBDD
                 balanceLocal.setBalance(new Double(balance));
                 }
                 else
                 {
                 //No se cumple la condición, luego se finaliza el proceso
                 throw new LimiteBalanceException();
                 }
                 }catch (ObjectNotFoundException e)
                 {
                 if (LogUtil.esInfo(this.getClass()))
                 LogUtil.info("No encuentra el balance. Se procede a crearle",this.getClass());
                 try {
                 balanceLocal=balanceLocalHome.create(idCliente,new Double("0"),new Double("0"),new Double("500"),"S");
                 } catch (CreateException e2) {
                 if (LogUtil.esError(this.getClass()))
                 LogUtil.error("Error al crear el balance",e2,this.getClass());
                 }
                 //e.printStackTrace();
                 }
                
                 }catch (NumberFormatException e1) {
                 if (LogUtil.esError(this.getClass()))
                 LogUtil.error("Error en el formato del id_cliente",e1,this.getClass());
                 } catch (FinderException e1) {
                 if (LogUtil.esError(this.getClass()))
                 LogUtil.error("Error al encontrar el balance del cliente con id="+idCliente,e1,this.getClass());
                 }
                 }


                I can't see what is wrong. I think the formats are like on database...

                • 5. Re: No such entity WHY?
                  Jarva Jarva Newbie

                  Ok, i've found the answer.
                  The problem was that i thought that the method i will not implement wasn't necessary to be included on the bean that will be autogenerated with Xdoclet. So those methods weren't included: ejbActivate, ejbPassivate, ejbLoad, ejbStore, ejbRemove. When i have included them, i haven't exceptions.
                  Thanks to sviluppatorefico and jobor because of trying to help me.
                  Best regards!