1 Reply Latest reply on Jun 17, 2004 9:55 AM by mrking

    ejbStore not updating database...

    mrking Newbie

      Hi there,

      I'm a bit of a newbie, so I hope someone can anser this. I'm building a simple application to administer a Product table in a PostgreSQL database. I'm using Lomboz and Eclipse to generate the ProductBean, and it seems to be connecting to the database and creating the beans with the appropriate data correctly. The Product table has only three rows, sku, quantity and price.

      I'm now at the stage where I need to be able to update the row in the database. To do this, I've been calling the setQuantity() etc. methods in the automatically-generated ProductData object that each bean has to store its data. However, the database is not being updated with the new values (though they are received correctly by the method containing the set calls).

      I believe that the framework should automatically be calling ejbStore once the method in which these set calls take place completes. This is indeed the case (I put a debug message in the ejbStore() method of the automatically-generated ProductCMP class, which is otherwise empty). However, the new values are not stored; it appears that ejbStore does nothing.

      If anyone can help me with this I would be very grateful as I am otherwise unable to proceed. I am using JBoss 3.2.1. The jbosscmp-jdbc.xml file is as follows:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
      
      <jbosscmp-jdbc>
       <defaults>
       <datasource>java:/PostgresDS</datasource>
       <datasource-mapping>PostgreSQL</datasource-mapping>
       <preferred-relation-mapping>PostgreSQL</preferred-relation-mapping>
       </defaults>
      
       <enterprise-beans>
      
       <!--
       To add beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
       that contains the <entity></entity> markup for those beans.
       -->
      
       <entity>
       <ejb-name>Product</ejb-name>
       <table-name>Product</table-name>
      
       <cmp-field>
       <field-name>sku</field-name>
       <column-name>sku</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>quantity</field-name>
       <column-name>quantity</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>price</field-name>
       <column-name>price</column-name>
      
       </cmp-field>
      
       </entity>
      
       </enterprise-beans>
      
      </jbosscmp-jdbc>
      


      Thanks for any assistance you can give...