For development and deployment of my WAR application I use the drop-and-create
functionality. Basically erasing everything from the database and then automatically recreating all the necessary tables and fields according to my @Entity-classes.
Obviously, for production the drop-and-create
functionality is out of question. How would I have to create the database tables and fields?
The nice thing about @Entity-classes is that due to OQL
and the use of EntityManager
all the database queries are generated, hence the WAR application gets database independent. If I now had to create the queries by hand in SQL and then let the application execute them, then I would have to decide in which sql dialect they are (i.e. MySQL, Oracly, SQL Server, ...). Is there a way to create the tables database independently? Is there a way to run structural database updates as well database independently (i.e. for database version 1 to database version 2)? Like altering field or table names, adding tables, droping tables, etc.?