1. 程式人生 > >資訊: Hibernate Validator bean-validator-3.0-JBoss-4.0.2

資訊: Hibernate Validator bean-validator-3.0-JBoss-4.0.2

解決方案:

在sessionFactory中加入

<prop key="javax.persistence.validation.mode">none</prop>

就可以了

我的完整程式碼如下

<bean id="localSessionFactoryBean"
		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
		<property name="dataSource" ref="basicDataSource"></property>
		<property name="hibernateProperties">
			<props>
			
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				<prop key="javax.persistence.validation.mode">none</prop>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
			</props>
		</property>
		
		<!-- 新增對映檔案 -->                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
		<property name="mappingLocations" value="classpath*:cn/com/bean/*.hbm.xm"></property>
	</bean>