4 Replies Latest reply on May 27, 2003 12:24 PM by ASSFACE JACKSON

    Record is deleted from mysql database after object is loaded

    ASSFACE JACKSON Newbie

      jboss-3.2.1_tomcat-4.1.24
      mysql-3.23.54

      I am using the simple Gangster CMP template that comes with the jboss docs to test if it works on my own data tables. When I call findByPrimaryKey() to load the data but immediately afterwards the record I loaded gets deleted from the table. This happens everytime and I have no idea why or how to prevent it. Is there a flag similar to <remove-table> that keeps jboss from deleting records after they are loaded?

      Here is the dump from the mySQL log:

      4 Query SET autocommit=0
      4 Query SELECT user_id FROM user WHERE user_id=175
      4 Query commit
      4 Query SET autocommit=1
      4 Query SHOW VARIABLES LIKE 'tx_isolation'
      4 Query SET autocommit=0
      4 Query SELECT username, email_address FROM user WHERE (user_id=175)
      4 Query commit
      4 Query SET autocommit=1
      4 Query SHOW VARIABLES LIKE 'tx_isolation'
      4 Query SET autocommit=0
      4 Query SELECT username, email_address FROM user WHERE (user_id=175)
      4 Query DELETE FROM user WHERE user_id=175
      4 Query commit

      As you can see there is a nice little DELETE call in there. I have nothing in my ejbRemove() and my jbosscmp-jdbc.xml has nothing beyond the template:

      <jbosscmp-jdbc>

      java:/MySqlDS
      <datasource-mapping>mySQL</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <pk-constraint>true</pk-constraint>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>


      <ejb-name>JobEJB</ejb-name>
      <table-name>user</table-name>

      <cmp-field>
      <field-name>id</field-name>
      <column-name>user_id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>name</field-name>
      <column-name>username</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>email</field-name>
      <column-name>email_address</column-name>
      </cmp-field>


      </enterprise-beans>
      </jbosscmp-jdbc>