在DAO方法中我使用了Spring的HibernateTemplate,方法如下:
Hibernate生成的SQL語句如下
每次執(zhí)行時(shí),總是拋異常,說:
org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not execute query;
.....
Caused by: java.sql.SQLException: ORA-01722: invalid number
我實(shí)在不明白為什么會(huì)報(bào)這個(gè)錯(cuò)誤,難道Hibernate在set date或者set string之前不會(huì)對其進(jìn)行格式的轉(zhuǎn)換嗎?于是我又換了另外一個(gè)HQL語句,在代碼里面提前將Date格式成String,但還是報(bào)錯(cuò):
where to_char(dateType,'yyyy-mm-dd hh24:mi') = :strDate
后來實(shí)在沒辦法了,用了一陰招,代碼如下,測試通過,但是覺得這種代碼太丑陋了。
不知道各位能否解析一下上面那個(gè)報(bào)錯(cuò)的原因,謝謝先了!
1.<f:view>沒有設(shè)置locale,faces-config.xml沒有設(shè)置<local-config>時(shí)采用瀏覽器的默認(rèn)配置
2.<f:view>沒有設(shè)置locale,但faces-config.xml中設(shè)置了<local-config>時(shí),如果支持本地語言則采用<local-config>的<supported-locale>配置,否則采用<default-locale>
3.<f:view>設(shè)置了locale時(shí),faces-config.xml沒有設(shè)置<local-config>時(shí)采用<f:view>的配置
4.<f:view>設(shè)置了locale時(shí),且faces-config.xml中設(shè)置了<local-config>時(shí),采用<f:view>