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