net.yadaframework.tools.YadaSchemaGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yadaweb Show documentation
Show all versions of yadaweb Show documentation
Some useful tasks for the Yada Framework
The newest version!
package net.yadaframework.tools;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.Persistence;
/**
* Generates a db schema using the JPA standard.
* It depends on .../src/main/resources/META-INF/persistence.xml being properly configured.
*/
public class YadaSchemaGenerator {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("yadaPersistenceUnit");
emf.createEntityManager().close(); // This line triggers schema generation to file
emf.close();
}
}