Reputation: 777
Could you please let me know whether we have an option to generate ddl from entity class in intellij?
I could do the entity class generation from the table? I am looking to change the definition of a entity class and i need to re-generate the DDL for table?
I am using eclipse links for JPA.
Upvotes: 2
Views: 5096
Reputation: 120781
I would recommend to use eclipse link (not intellij) to create the ddl script.
With the ddl-generation.output-mode
in persistence.xml
you can instruct eclipse link to create an ddl script.
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<properties>
...
<property name="eclipselink.ddl-generation.output-mode" value="both"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.create-ddl-jdbc-file-name" value="createDDL_ddlGeneration.jdbc"/>
<property name="eclipselink.drop-ddl-jdbc-file-name" value="dropDDL_ddlGeneration.jdbc"/>
</properties>
</persistence-unit>
</persistence>
@see:
Upvotes: 1