How can I generate DDL from existing entities with annotations using a maven plugin?

后端 未结 2 1698
既然无缘
既然无缘 2021-01-15 12:56

I have maven project and I want to generate DDL from existing entities.

How can I do that?

Is there any maven plugin that I can generate the DDL?

I

2条回答
  •  甜味超标
    2021-01-15 13:12

    openjpa-maven-plugin plugin provides a goal sql. Using this goal, it is possible to create the DDL from existing entities.

    
    
        org.apache.openjpa
        openjpa-maven-plugin
        2.2.0
        
            **/entity/ *.class
            true
            com.ibm.db2.jcc.DB2Driver
            true
            ${basedir}/src/main/resources/META-INF/persistence.xml
            ${skip.jpa}
            ${basedir}/src/main/resources/database.sql
        
            
                
                     org.apache.openjpa
                     openjpa
                     2.1.1
                
                
                    org.slf4j
                    slf4j-api
                    1.6.6
                
                
                    org.slf4j
                    slf4j-simple
                    1.6.6
                
            
        
    
    
    
        org.apache.openjpa
        openjpa-maven-plugin
        
            
                sql
                generate-resources
                
                    sql
                
                                
        
    
    

提交回复
热议问题