2011-03-26 162 views
1

我试图从一组使用hibernate3-maven-plugin的hbm2ddl goal的JPA注释类生成DDL。我已经配置在我的pom.xml以下从JPA注释生成DDL

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>hibernate3-maven-plugin</artifactId> 
      <version>2.2</version> 
      <executions> 
       <execution> 
        <id>hibernate-create-schema</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>hbm2ddl</goal> 
        </goals> 
        <configuration> 
         <components> 
          <component> 
           <name>hbm2ddl</name> 
           <implementation>jpaconfiguration</implementation> 
          </component> 
         </components> 
         <componentProperties> 
          <jdk5>true</jdk5> 
          <persistenceunit>bm-domain</persistenceunit> 
          <outputfilename>create.sql</outputfilename> 
          <drop>false</drop> 
          <create>true</create> 
          <export>false</export> 
          <format>true</format> 
         </componentProperties> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

我的persistence.xml只包含以下内容:

<persistence-unit name="bm-domain" transaction-type="RESOURCE_LOCAL"> 
</persistence-unit> 

而且我添加了一个database.properties文件到指定的类路径:

hibernate.dialect=org.hibernate.dialect.MySQLDialect 

当我运行mvn install我得到的错误:

org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: user, for columns: [org.hibernate.mapping.Column(compatibleAnnualEarnings)]

这似乎是指用户类的下列属性

Set<AnnualEarnings> compatibleAnnualEarnings; 

@Enumerated(EnumType.STRING) 
AnnualEarnings annualEarnings; 

AnnualEarnings类是在用户类的包的子包中并因此被定义:

public enum AnnualEarnings implements Serializable{ 
    GROUP_1, GROUP_2, GROUP_3, GROUP_4, GROUP_5, GROUP_6, GROUP_7; 
} 

回答