I\'m playing around with some JPA stuff, changing the mappings to see how they\'re supposed to be etc. It\'s basic experimentation. However I can\'t find a tool that will si
When I use Hibernate I simply add this to my config file:
<property name="hbm2ddl.auto">update</property>
Takes care of everything. I'm not sure what the equivalent is for JPA, but it's so heavily influenced by Hibernate that I'd be surprised if you couldn't find something similar.
No tool needed. I usually just run a simple JUnit test and the database is created for me.
By maven plugin:
<plugin>
<!-- run "mvn hibernate3:hbm2ddl" to generate a schema -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<hibernatetool>
<classpath>
<path location="${project.build.directory}/classes" />
<path location="${project.basedir}/src/main/resources/META-INF/" />
</classpath>
<jpaconfiguration persistenceunit="galleryPersistenceUnit" />
<hbm2ddl create="true" export="false" destdir="${project.basedir}/target" drop="true" outputfilename="mysql.sql" format="true" console="true"/>
</hibernatetool>
</configuration>
</plugin>