0

도구 수출 POJO와 DAO :사용자 정의 최대 절전 모드 내가 생성하는 플러그인 받는다는을 사용

지독 DAO를하고 POJO 최대 절전 도구가 하드 코딩

같은 패키지에 생성되는

<groupId>org.codehaus.mojo</groupId> 
<artifactId>hibernate3-maven-plugin</artifactId> 
<version>2.2</version> 
<executions> 
    <execution> 
     <phase>generate-sources</phase> 
     <goals> 
      <goal>hbm2java</goal> 
      <goal>hbm2dao</goal> 
      <goal>hbm2ddl</goal> 
     </goals> 
    </execution> 
</executions> 
<configuration> 
    <components> 
     <component> 
      <name>hbm2java</name> 
      <implementation>configuration</implementation> 
      <outputDirectory>src/main/java</outputDirectory> 
     </component> 
     <component> 
      <name>hbm2dao</name> 
      <implementation>configuration</implementation> 
      <outputDirectory>src/main/java</outputDirectory> 
     </component> 
     <component> 
      <name>hbm2ddl</name> 
      <implementation>configuration</implementation> 
      <outputDirectory>src/main/resources/sql</outputDirectory> 
     </component> 
    </components> 
    <componentProperties> 
     <jdk5>true</jdk5> 
     <format>true</format> 
     <configurationfile>src/main/resources/hibernate/hibernate.cfg.xml</configurationfile> 

     <drop>true</drop> 
     <create>true</create> 
     <outputfilename>init.sql</outputfilename> 
     <templatepath>src/main/resources/templateftl</templatepath> 

    </componentProperties> 
</configuration> 

DAOExporter : setFilePattern("{package-name}/{class-name}Home.java"); 
POJOExporter : setFilePattern("{package-name}/{class-name}.java"); 

나는 그것이 극히 추한 것을 발견한다. 그리고 나는 다른 꾸러미에서 pojo와 dao를 가지고 싶어한다. 그리고 "Home"그러나 단지 "Dao"에 의한 Dao의 접미사도 붙이지 않는다

사용자 정의 Exporter 구현을 제공하거나이를 구현하기 위해 pluging에서 무언가를 구성 할 수있는 방법이 있는지 알고 있습니까?

감사

답변

0

는 마침내 나는 디 컴파일 및 플러그인의 코드를 읽고 JD-GUI를 사용하고 나는 그것이 2 배 목표 hbmtemplate와 플러그인 다른 템플릿을 사용하여 각 번 실행해야 할 관리 : 엔터티 하나를 하나는 DAO를위한거야.

사용자 정의 내보내기를 exporterclass에 지정하여 사용할 수 있음을 알았습니다. 메이븐 플러그인은 xsd의 왕이 부족합니다 ...

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>hibernate3-maven-plugin</artifactId> 
    <version>2.2</version> 
    <executions> 
     <execution> 
      <phase>generate-sources</phase> 
      <id>genpojo</id> 
      <goals> 
       <goal>hbmtemplate</goal> 
       <goal>hbm2ddl</goal> 
      </goals> 
      <configuration> 
      <components> 
       <component> 
        <name>hbmtemplate</name> 
        <implementation>configuration</implementation> 
        <outputDirectory>src/main/java</outputDirectory> 
       </component>       
       <component> 
        <name>hbm2ddl</name> 
        <implementation>configuration</implementation> 
        <outputDirectory>src/main/resources/sql</outputDirectory> 
       </component> 
      </components> 
      <componentProperties> 
       <jdk5>true</jdk5> 
       <format>true</format> 
       <configurationfile>src/main/resources/hibernate/hibernate.cfg.xml</configurationfile> 
       <drop>true</drop> 
       <create>true</create> 
       <outputfilename>init.sql</outputfilename> 
       <templatepath>src/main/resources/templateftl</templatepath> 
       <filepattern>{package-name}/pojogen/{class-name}.java</filepattern> 
       <template>pojo/Pojo.ftl</template> 
      </componentProperties> 
     </configuration> 
     </execution> 
     <execution> 
      <phase>generate-sources</phase> 
      <id>gendao</id> 
      <goals>       
       <goal>hbmtemplate</goal> 
      </goals> 
      <configuration> 
      <components>       
       <component> 
        <name>hbmtemplate</name> 
        <implementation>configuration</implementation> 
        <outputDirectory>src/main/java</outputDirectory> 
       </component> 
      </components> 
      <componentProperties> 
       <jdk5>true</jdk5> 
       <format>true</format> 
       <configurationfile>src/main/resources/hibernate/hibernate.cfg.xml</configurationfile> 
       <drop>true</drop> 
       <create>true</create> 
       <templatepath>src/main/resources/templateftl</templatepath> 
       <!-- <exporterclass>com.db.exporter.MyDAOExporter</exporterclass>--> 
       <filepattern>{package-name}/daogen/{class-name}Dao.java</filepattern> 
       <template>dao/daohome.ftl</template> 
      </componentProperties> 
     </configuration> 
     </execution> 
    </executions> 

</plugin>