1
我正在设置一个使用hibernate的项目,并且正在编写类并添加注释以避免编写.hbm.xml文件。我也在努力使用Maven Hibernate3的插件专门hbm2dao并为就是hbm2ddl DAO和数据库的建立,但我得到的错误使用maven插件生成hibernate dao和ddl
failed: Unable to load class declared as <mapping class=package.ClassName.....
的hibernate.cfg.xml如下:该插件
<hibernate-configuration>
<session-factory name="jndi/composite/SessionFactory">
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">PASS</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/DATABASE</property>
<property name="hibernate.connection.username">USER</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory </property>
<property name="hibernate.use_sql_comments">true</property>
<mapping class="package.....models.User"/>
</session-factory>
</hibernate-configuration>
配置在pom.xml
<configuration>
<components>
<component>
<name>hbm2dao</name>
<implementation>annotationconfiguration</implementation>
<outputDirectory>target/generated-sources/hibernate3</outputDirectory>
</component>
</components>
<componentProperties>
<jdk5>true</jdk5>
<ejb3>false</ejb3>
<packagename>package......models</packagename>
<format>true</format>
<haltonerror>true</haltonerror>
<scan-classes>true</scan-classes>
</componentProperties>
</configuration>
任何信息,我可能会忘记只是问,谢谢。
您的错误是否以'无法加载类声明为'结束? – 2012-03-26 07:47:36
我没有格式正确对不起,现在应该可见。 – LoneWolf 2012-03-26 09:19:36