3 Replies Latest reply on Apr 24, 2003 12:47 AM by kevin111

    PostCreate bug?!

    kevin111 Newbie

      I am using Jboss 3.2. I have written some simple beans and I have found out that ejbPostCreate is not called after the corresponding ejbCreate before serving a client. My code flow is like this:

      0. start a session bean
      [the following are inside the session bean]
      1. create a new entity bean using local interface
      2. get a local reference to this bean using local home
      3. prepare the data to send to a remote client
      ...

      According to J2EE specification, the ejbPostCreate callback should be called by the time I get to step 2 above. But it was not according to my debugging messages.

      Is this a bug or is it something I did wrong or didnt understand correctly?

      Any help is appreciated.

        • 1. Re: PostCreate bug?!
          Adrian Brock Master

          Show the code.

          If this wasn't working CMR wouldn't be working.

          Regards,
          Adrian

          • 2. Re: PostCreate bug?!
            kevin111 Newbie

            First of all, thanks a lot for trying to help. :)

            After hours of struggle, I finally figured out what is the problem:

            I am using CMPand using MySQL. the entity bean's DB table contains something like this:
            id -- auto-increment id
            name -- unique column.

            It seems like there some problem using database auto generated id as the primary key. The sever log would look like:
            Create: pk= null
            ...

            Then I got all kinds of problem from this. Now I switched to use name as the primary key for CMP, then everything works as desired.

            Once again, thanks for the help.

            Kevin

            • 3. Re: PostCreate bug?!
              kevin111 Newbie

              A follow-up question:

              Is there a solution to my problem with id being the primary key? If possible, I would like to use it as primary key.