Announcement Announcement Module
No announcement yet.
Database Records After Logout Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Database Records After Logout


    First, I'd like to mention that I'm a newbie to spring roo and hibernate as well.

    Second, I followed the basic tutorial for spring on the blog and everything is fine and working great. But, I have tried using MYSQL instead. I works fine as well except that after entering some data and then logging out, the data gets lost.

    Do you have any idea why this happens? Is this intentional?

    Thank you

  • #2

    When you are ready to test or install your application in a production setting, the persistence setup command can be repeated. This allows you to nominate a different database, or even ORM. Roo offers TAB completion for production databases including Postgres, MySQL, Microsoft SQL Server, Oracle, DB2, Sybase, H2, Hypersonic and more. Another important step is to edit the SRC_MAIN_RESOURCES/META-INF/persistence.xml file and modify your JPA provider's DDL (schema management) configuration setting so it preserves the database between restarts of your application. To help you with this, Roo automatically lists the valid settings for your JPA provider as a comment in that file. Note that by default your JPA provider will drop all database tables each time it reloads. As such you'll certainly want to change this setting.


    • #3
      Hi Ben,

      Thanks for the quick reply. I had lots of things to do so I couldn't check your solution.

      I have tried changing the
      <property name="" value="create"/>
      <property name="" value="update"/>
      and it works fine, i.e data is preserved between restarts

      But I couldn't find the comments in the persistence.xml file.
      To help you with this, Roo automatically lists the valid settings for your JPA provider as a comment in that file.
      Am I missing something?
      Last edited by araouf; Mar 13th, 2010, 05:57 AM.


      • #4
        If you look into persistence.xml:

            <persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
                    <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
                    <!--value='create' to build a new database on each run; value='update' to modify an existing database; value='create-drop' means the same as 'create' but also drops tables when Hibernate closes; value='validate' makes no changes to the database-->
                    <property name="" value="create"/>
                    <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
        .. you should see the comment that Roo includes into the configuration...



        • #5
          Hi Stefan,

          Although my problem is now fixed, I'd like to note that I didn't find the comment. I even created a new project from scratch to test this issue but it seems there is no comment added to the file. I am using 1.0.1.RELEASE [rev 601].

          Thank you.