Allowed values for javax.persistence.schema-generation.database.action
are
- none (that doesn't serve anything...)
- create (which only works the first time the application is started because all further starts fail due to most databases (e.g. derby 11.x) fail if a schema that already exist is created
- drop-and-create (which wouldn't ever persist any data which raises the question why it's part of a persistence standard specification - assuming debugging purpose)
- drop (symetrically fails
create
succeeds
which leaves absolutely no option to use any of these value nor do I see any sense in their specification - assuming you don't want the user of your application to start the application once (with create
), hack the persistence.xml
file, repackage you application and use it with none
. How to use them to persist Java objects accross application restarts, then?
I know about Hibernate's hibernate.hbm2ddl.auto
which works great, but I'm trying to get the mystery solved for a JPA 2.1 implementation portable approach.