0
我使用Struts /泉/休眠和Tomcat 7.0,並試圖啓動服務器時,我發現了一個問題,Hibernate的映射。休眠:無法應用約束的DDL
控制檯會打印:
Mapping class: path.vo.ObjectVO -> TABLE_NAME
在休眠文件夾中找到在HibernateSessionFactory.xml文件及其關聯VO對象中的每個項目。它將成功遍歷整個列表。
然而,一旦這似乎是成功的,它悶死了一對夫婦的對象,給這個錯誤:
WARN: Unable to apply constraints on DDL for path.vo.ObjectVO
java.lang.ClassNotFoundException: path.vo.ObjectVO
奇怪的是,所使用的服務器來運行良好。自從它成功運行以來,我沒有更改任何hibernate配置文件,VO對象或數據庫模式本身。我的研究僅導致人們用他們的配置文件解決了問題,這些問題對我來說並不奏效。
任何幫助,將不勝感激。以下是我正在使用的一些文件。
HibernateSessionFactory.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- Hibernate session factory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>hibernate/ClassA.hbm.xml</value>
<value>hibernate/ClassB.hbm.xml</value>
</list>
</property>
</bean>
ClassA.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="path.to.ClassAVO" table="CLASSA">
<id name ="Id" type="int">
<column name="ID"/>
<generator class="identity" />
</id>
<property name="somecolumn" type="string">
<column name="Somecolumn" length="24" not-null="true" />
</property>
...
</class>
</hibernate-mapping>
你映射ObjectVO於某些表? VO不應該是持久的 – 2013-03-18 05:31:15
@HenryLeu我認爲這行代碼如下: –
user1287523
2013-03-19 03:25:22