Announcement Announcement Module
No announcement yet.
upgrading and deploying Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • upgrading and deploying

    how does db upgrades and init deployment work with a roo app? will the app create my db the first the the war is deployed and ran or will roo generate a ddl file? then what happens when you want to upgrade and you have changes with your entities?

    i normally just keep a db script for each version that gets ran before deploying the war.

  • #2
    Roo uses JPA which allows you to map to existing tables or it will create the db schema at deployment time (check the Roo logs to see it happening). Changes to your domain model will require redeployment to the Web container and the database schema is adjusted at the same time. For this reason the ddl creation schema is set to 'create' in the persistence XML file which means that all entered data will be lost with each redeployment so JPA can create a complete new schema based on your latest changes to the domain model.

    So there is no need to keep or maintain a separate database ddl script as JPA takes care of this conveniently for you. When developing applications with Roo all of these details are managed automatically for you so you can concentrate on the development of your application.



    • #3
      what if i don't want to lose my data?


      • #4
        If you are using hibernate you can change the ddl settings in the persistence.xml from:

        <property name="" value="create"/>


        <property name="" value="update"/>

        The other ORM providers have a similar syntax which you can google for.

        This way you will keep your data (as long as you use a persistent DB).

        However, as long as your domain model changes I suggest you keep using create so the changes can be accommodated cleanly. Only if your domain model is stable you could try to use 'update'.