views:

29

answers:

0

As also described here, I'm trying to determine the best way to initialize and update my application's database. I use EclipseLink-JPA2. I distribute a NetBeans platform application.

Considered options:

  • use create-tables ddl-generation: The problem with this is that everytime the application runs it will throw exceptions, failing to create the tables. It will be useful only at setup time. This would be similar to placing checking code in the module restored() method.

  • include the database with the application distribution: the ddl-generation strategy becomes do nothing. I could still use the JPA (at development time) to generate the database files (embedded Java DB).

The best solution would be for the installer/setup (first-time) to call initializing code that creates the database. This precisely what I do with JWS in here. But I don't know how to do that without JWS. A script/jar executed by the installer?

related questions