Search code examples
javahibernatejpaopenjpa

Auto Update OpenJPA tables


Is there a way to tell OpenJPA to automatically update tables in the database on application deployment?

I know that hibernate has a property:

<prop key="hibernate.hbm2ddl.auto">update</prop>

Is there something similar in OpenJPA?


Solution

  • Yes:

    <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
    

    http://openjpa.apache.org/builds/2.2.0/apache-openjpa/docs/ref_guide_conf_jdbc.html#openjpa.jdbc.SynchronizeMappings

    Sebastian