5 Replies Latest reply on Oct 29, 2002 12:59 PM by tdhak

    ejbpostcreate not being called

    tdhak

      Hi,

      What is the most likely cause of the ejbPostCreate method not being called?

      I have a session fascade that creates an 2 entity beans. The second ones create method takes the first one as a parameter. The ejbPostCreate then calls this.setBean(bean) method to set the CMR field.

      However, this method never gets called cos ejbPostCreate never gets called, so the foreign key in the table ends up being null.

      Any help would be greatly appreciated.

      Tarwinder Dhak

        • 1. Re: ejbpostcreate not being called
          joelvogt

          possibly just check your method declaration so it matches with what it should be. Also make sure your catching and error that might be causing hassles when you try to access the first created object

          • 2. Re: ejbpostcreate not being called
            tdhak

            Thanks for the reply,

            OK, I've simplified things a little bit, to try to get to the cause of the problem. I'm now only creating 1 entity ejb in my session fascade, and yet ejbPostCreate is still not being called.

            Below is an extract from the entity bean I'm creating:-

            /**
            * @ejb.create-method view-type="local"
            */
            public java.lang.Integer ejbCreate(String username, String password,
            int state)
            throws javax.ejb.CreateException
            {
            this.setUsername(username);
            this.setPassword(password);
            this.setState(state);
            this.setCreated(new Date());

            return null;
            }

            public void ejbPostCreate(String username, String password,
            int state)
            {
            System.out.println("ejbPostCreate() got called !!");
            }

            /**
            * @ejb.create-method view-type="local"
            */
            public java.lang.Integer ejbCreate(String username, String password,
            int state, UserDetailsEntityEJBLocal userDetails)
            throws javax.ejb.CreateException
            {
            this.setUsername(username);
            this.setPassword(password);
            this.setState(state);
            this.setCreated(new Date());

            return null;
            }

            public void ejbPostCreate(String username, String password,
            int state, UserDetailsEntityEJBLocal userDetails)
            {
            System.out.println("ejbPostCreate got called !!");
            this.setUserDetails(userDetails);
            }

            I really don't understand whats going on, this is now a case of a simple entity EJB where JBoss is not calling back the ejbPostCreate method. Its driving me mad !!

            Thanks a again to anyone that can help me.

            Tarwinder Dhak

            • 3. Re: ejbpostcreate not being called
              tdhak

              Hi, here's a the contents of the logs if this helps anyone track down the problem. As you can see no error or warning is generated, so where do I look for the problem !!


              2002-10-28 01:38:14,996 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=create
              2002-10-28 01:38:15,003 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is null
              2002-10-28 01:38:15,011 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for create
              2002-10-28 01:38:15,015 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx null
              2002-10-28 01:38:15,031 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//12, BranchQual=]
              2002-10-28 01:38:15,037 TRACE [org.jboss.ejb.plugins.StatefulSessionInstancePool] Get instance org.jboss.ejb.plugins.StatefulSessionInstancePool@25753d#true#class tsd_software.j2ee.user_management.ejbs.implementations.UserManageSessionEJB
              2002-10-28 01:38:15,374 TRACE [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] entryAdded, entry=key: 1035742691703, object: 968f9, entry: cae5b7
              2002-10-28 01:38:15,387 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally
              2002-10-28 01:38:15,396 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT:before commit of TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//12, BranchQual=]
              2002-10-28 01:38:15,405 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT:after commit of TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//12, BranchQual=]
              2002-10-28 01:38:15,410 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=create
              2002-10-28 01:38:17,099 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=addUser
              2002-10-28 01:38:17,106 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is null
              2002-10-28 01:38:17,131 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for addUser
              2002-10-28 01:38:17,135 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx null
              2002-10-28 01:38:17,148 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//13, BranchQual=]
              2002-10-28 01:38:17,703 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=findByUsername
              2002-10-28 01:38:17,712 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//13, BranchQual=]
              2002-10-28 01:38:17,717 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for findByUsername
              2002-10-28 01:38:17,727 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//13, BranchQual=]
              2002-10-28 01:38:17,735 TRACE [org.jboss.ejb.plugins.EntityInstancePool] Get instance org.jboss.ejb.plugins.EntityInstancePool@c8c6d9#true#class tsd_software.j2ee.user_management.ejbs.implementations.UserEntityEJB
              2002-10-28 01:38:17,917 DEBUG [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory] Using properties: {user=ams-web, password=ams-web}
              2002-10-28 01:38:18,147 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.UserEntityEJB.findByUsername] Executing SQL: SELECT t0_o.id FROM USER t0_o WHERE t0_o.username = ?
              2002-10-28 01:38:18,197 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally
              2002-10-28 01:38:18,208 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=findByUsername
              2002-10-28 01:38:18,224 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=create
              2002-10-28 01:38:18,246 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//13, BranchQual=]
              2002-10-28 01:38:18,256 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for create
              2002-10-28 01:38:18,279 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//13, BranchQual=]
              2002-10-28 01:38:18,291 TRACE [org.jboss.ejb.plugins.EntityInstancePool] Get instance org.jboss.ejb.plugins.EntityInstancePool@c8c6d9#true#class tsd_software.j2ee.user_management.ejbs.implementations.UserEntityEJB
              2002-10-28 01:38:18,446 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.UserEntityEJB] Create: pk=null
              2002-10-28 01:38:18,455 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.UserEntityEJB] Executing SQL: SELECT COUNT(*) FROM USER WHERE id=?
              2002-10-28 01:38:18,480 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.UserEntityEJB] Executing SQL: INSERT INTO USER (id, username, password, created, last_login, state) VALUES (?, ?, ?, ?, ?, ?)
              2002-10-28 01:38:18,517 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.UserEntityEJB] Rows affected = 1
              2002-10-28 01:38:18,528 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally
              2002-10-28 01:38:18,533 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=create
              2002-10-28 01:38:18,542 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally
              2002-10-28 01:38:18,551 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT:before commit of TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//13, BranchQual=]
              2002-10-28 01:38:18,555 TRACE [org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor] beforeCompletion called
              2002-10-28 01:38:18,566 TRACE [org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor] afterCompletion called
              2002-10-28 01:38:18,575 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT:after commit of TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//13, BranchQual=]
              2002-10-28 01:38:18,581 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=addUser
              2002-10-28 01:38:18,644 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=remove
              2002-10-28 01:38:18,651 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is null
              2002-10-28 01:38:18,657 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED for remove
              2002-10-28 01:38:18,662 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx null
              2002-10-28 01:38:18,676 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//14, BranchQual=]
              2002-10-28 01:38:18,700 TRACE [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] entryRemoved, entry=key: null, object: null, entry: cae5b7
              2002-10-28 01:38:18,704 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally
              2002-10-28 01:38:18,713 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT:before commit of TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//14, BranchQual=]
              2002-10-28 01:38:18,718 TRACE [org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor] beforeCompletion called
              2002-10-28 01:38:18,722 TRACE [org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor] afterCompletion called
              2002-10-28 01:38:18,732 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT:after commit of TransactionImpl:XidImpl [FormatId=257, GlobalId=pluto//14, BranchQual=]
              2002-10-28 01:38:18,737 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=remove

              • 4. Re: ejbpostcreate not being called
                tdhak

                Is there anybody out there that can help me ???

                • 5. Re: ejbpostcreate not being called
                  tdhak

                  Is anybody going to at least try to help me ??