2 Replies Latest reply on Jul 2, 2003 7:16 AM by pmalone

    database empty on restart

    pmalone

      Hi all,
      I am a bit of a newbie with J2EE and Jboss and probably I am doing something simple wrong. I would appreciate some help.

      I am using jboss 3.0.4 and have managed to create CMP managed entity beans which are persisting via HyperSQL. I can look in the default.script file and see the deletes and inserts as I update the entities via my client.

      The problem arises when I shutdown Jboss.... the default.script is rewritten with only all the default CREATE ALIAS statements, and all the updates that I have created dissappear...

      When I restart Jboss and my jar is deployed, the table is created from scratch and is of course empty. Only when I create new entity beans does the script once again fill with the INSERT and DELETE statements.

      I have looked through archives on this forum (and others) but have yet to find anyone else with this problem.

      I am sure this is something very simple. How can I configure JBoss to persist this data on shutdown ??? I would have thought that this was the default behaviour.

        • 1. Re: database empty on restart
          pranav

          What all .xml files you have in the meta-inf folder for the ejb...? If you have jbosscmp-jdbc.xml file in it, then look into it, and under tag you will find a tag <remove-table>true</remove-table>, make its value as false. If you have a jaws.xml file, in that also change this setting...

          May be you don;t have either of these two files...then do the following....
          1. Move to your <JBOSS_HOME>/server/<server-type>/conf folder. (here <server-type> means all, default or minimal.
          2. Under this folder you will find standardjbosscmp-jdbc.xml and standardjaws.xml files.
          3. standardjaws.xml will have entry as following:
          <default-entity>
          <create-table>true</create-table>
          <remove-table>true</remove-table> <tuned-updates>true</tuned-updates>
          <read-only>false</read-only>
          <time-out>300</time-out>
          <row-locking>false</row-locking>
          <read-ahead>false</read-ahead>
          </default-entity>

          make the <remove-table> tag value as false

          4. standardjbosscmp-jdbc.xml will have entry as following:


          java:/DefaultDS
          <datasource-mapping>Hypersonic SQL</datasource-mapping>

          <create-table>true</create-table>
          <remove-table>true</remove-table> <read-only>false</read-only>
          <time-out>300</time-out>
          <pk-constraint>true</pk-constraint>
          <fk-constraint>false</fk-constraint>
          <row-locking>false</row-locking>
          <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
          <read-ahead>
          on-load
          <page-size>1000</page-size>
          <eager-load-group>*</eager-load-group>
          </read-ahead>
          <list-cache-max>1000</list-cache-max>
          ....


          In this one also change the value of <remove-table> to false...

          Cheers...

          • 2. Re: database empty on restart
            pmalone

            Thanks,

            That is it exactly. Actually I am gereating my EJB using xdoclet and the @jboss:remove-table remove="true" tag was indeed my problem. I changed this to "false", redeployed and hey presto it works.

            Thanks again for a prompt and accurate response...