2 Replies Latest reply on Feb 9, 2004 11:29 AM by n_ton

    Entity bean lost its data

    n_ton

      Hi,

      I have a weird problem that I hope someone can help me with. I have a BMP entity bean that represents a db table in our system. It is a really simple table of only three columns, so there are only three properties in the EJB.

      We have a servlet that gets called to create rows in the database using the EJB home interface create() method. A jsp page can then be opened to see what was inserted in the database. The primary keys are retrieved in a separate page and passed to the display page where a findByPrimaryKey() is called. Our problem is that somewhere between the servlet call and the display page, the EJBs lose their data. All the properties in the EJB are null or 0.

      I put debugging in the EJB method calls and, as expected, the ejbFindByPrimaryKey() and ejbLoad() methods are not executed by the jsp page. The ejbLoad() is called after the create.

      Any idea how/why the EJB would lose its data?

      I'm running JBoss 3.0.6 on RH 7.3 and MySQL 4.0.12.

      Thanx in advance.

      Norton

        • 1. Re: Entity bean lost its data

          Is that MySQL transaction enabled?

          • 2. Re: Entity bean lost its data
            n_ton

            Yes, it is.

            Actually, I found the problem. I developed this EJB a little differently than all the others I did and had working. It turned out that I had forgotten to set the properties of the EJB in the ejbCreate() method after the database insert. Since the properties were never set, they still had their initialized state.

            I hate it when I make stupid mistakes like that.

            Thanx for trying to help.

            Norton