3 Replies Latest reply on Nov 11, 2003 3:56 AM by wunderkind

    EjbPostCreate() don't execute!!!

    Marcos Adrian Jara Newbie

      Hello people!!!

      I want to know why the EjbPostCreate method not execute.

      I need that this method for entablished the relationship CMR field assignment.

      I put a message in this method like that:

      public void ejbPostCreate(VagasValue xVagasValue) throws Exception
      {
      System.out.println("Metodo EJB-POSTCREATE ");
      this.setCd_concedente(xVagasValue.getCd_concedente());
      }

      but it don't show in the Jboss screen service.!!!

      The deploy is execute correctly, and the execution too, but the foreign key field in the table is not saved..

      Sorry for my bad english!!


      Thanks

        • 1. Re: EjbPostCreate() don't execute!!!
          wunderkind Newbie

          i had a similar problem. you may not set cmp fields within
          the ejbPostCreate() method. this is an ejb-spec fact. Additionally you may not
          set cmr fields within the ejbPostCreate() if they
          are container managed. just do not implement the ejbPostCreate. The container (should) do everything
          for you....

          hope this helps,
          sven alias wunderkind

          • 2. Re: EjbPostCreate() don't execute!!!
            Marcos Adrian Jara Newbie

            Ok thank you!!!

            I have not problem with the relationship, i can view and use correctly all public methods of a entity bean from another entity bean without problem.

            When i delete the parent entity, the child entity bean is deleted too, because the relation are established in cascade-delete.

            The unique problem has when i want to save the child entity, this may save the parent id if all references is ok, or may generate an error if something is bad.

            The really complication is that the child entity bean never save the parent id in the child table, i don't know why?

            You tell me that the relation is execute automatiquelly for the container, but i think there isn't!!

            I think that the major problem now is that the ejbPostCreate() don't execute. Can exist any problem here but i don't know!!!

            How i send you my code example for examine ???


            Because,

            • 3. Re: EjbPostCreate() don't execute!!!
              wunderkind Newbie

              Hello,

              are you trying to use a relation table for the relation mapping? This is what you should do in normal case?

              > You tell me that the relation is execute automatiquelly
              > for the container, but i think there isn't!!

              If you are using container managed persistence (cmp)
              you really should have found the acronym cmr in the docs.
              this means: container managed relationships. no persistence AND no relationship code is needed.