1. 程式人生 > >org.hibernate.QueryException: could not resolve property錯誤的解決方法

org.hibernate.QueryException: could not resolve property錯誤的解決方法

       出現這個異常,大多是因為我們在HQL和SQL語句的使用上造成混淆。因為Hibernate使用的是hql語法,而sql語法和它是有區別的。當然了,加入表的欄位和對映成hbm.xml檔案中屬性欄位一樣的話,就很少發生這樣的情況。

       比如:ID是表的欄位,那麼在hbm.xml檔案中也是ID,做檢索的時候就不能發生問題了。但是,加入我的表的欄位是Person_Name,那麼在hbm.xml檔案中可能就是personName,那麼大家在使用欄位的時候就的注意,否則就會出現org.hibernate.QueryException: could not resolve 這個異常。

下圖為我自己的資料庫實體屬性

這裡寫圖片描述

下圖為我自己定義的javabean

這裡寫圖片描述

下圖為對映檔案

這裡寫圖片描述

       對整個程式碼修改的時候,因為添加了新的需求,加上對ssh框架不熟悉,對hql語句不熟悉,沒想到還需要進行對映。

相關推薦

org.hibernate.QueryException: could not resolve property錯誤解決方法

       出現這個異常,大多是因為我們在HQL和SQL語句的使用上造成混淆。因為Hibernate使用的是hql語法,而sql語法和它是有區別的。當然了,加入表的欄位和對映成hbm.xml檔案中屬性

出現“org.hibernate.QueryException: could not resolve property錯誤解決

org.hibernate.QueryException: could not resolve property 的問題,這是由於HQL和SQL的語句使用不同造成的。hibernate使用hql語法,而sql語法與hql是不一樣的。使用hql時,欄位名要與

出現“org.hibernate.QueryException: could not resolve property錯誤解決,針對多對一的表的結構

今日在使用SSH框架進行資料庫檢索的時候,突然就出現了這個錯誤,欄位解析失敗,經過百度發現幾乎所有的網上的同行都在說是由於對映檔案與實體類欄位不匹配,或者說是hql語句中的欄位不匹配,但是,我檢查了好多遍,發現根本不是這方面的問題,因為我的欄位完全沒有錯。如果按照資料庫中其他

org.hibernate.QueryException: could not resolve property解決辦法

could not resolve property: cust_name of: domain.Customer could not resolve property: cust_name of: domain.Customer; nested excepti

數據庫異常整理:org.hibernate.QueryException: could not resolve property: “mStation”

blog use could not 小寫字母 www. 實例變量 特殊情況 lips 數據 最近用hibernate作數據庫查詢,結果遇到問題: org.hibernate.QueryException: could not resolve property: ‘mSta

org.hibernate.QueryException: could not resolve property: processInstanceId of:引數問題

報異常: org.hibernate.QueryException: could not resolve property: processInstanceId of: com.notice.ent

Stacktraces org.hibernate.QueryException: could not resolve property: name of: Entity.Person [ from

org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:67) org.hibernate.persister.entity.AbstractP

org.hibernate.QueryException: could not resolve property:xxxxxid 外來鍵查詢 hibernate

轉載:http://zhidao.baidu.com/link?url=IqxAQMkf0qRbYNqKKmjLLZ_zSZOQf-RGJ5lmokc04VDLDQJWS1MP14lFnevGB2rCS0WtifXaAAcqRmEqNY8tHq 我有兩張表:Teacher

【轉】Spring項目啟動報"Could not resolve placeholder"解決方法

web 啟動 not res org 文件 rop 出現 沒有 問題的起因:   除去properites文件路徑錯誤、拼寫錯誤外,出現"Could not resolve placeholder"很有可能是使用了多個PropertyPlaceholderConfigur

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely錯誤解決方法

將一個list矩陣轉化為numpy陣列之後,使用np.isnan()方法,報出了這麼一個錯誤: TypeError: ufunc ‘isnan’ not supported for the input types, and the inputs could not be sa

【JAVA學習】hibernate could not resolve property: com of

這個異常一般是因為對映檔案造成的請逐一排查: 1.hibernate.config.xml中新增的對映檔案是否正確 2.對映檔案中的類是否正確指定。 3.對映檔案對映的屬性名是否跟類中的屬性名一致。 4.對映檔案對映的屬性型別是否跟類中的屬性一致。 5.對映檔案對映到屬性在

SSH框架問題——hbm.xml配置出現的org.hibernate.MappingException: Could not determine type for:(貌似叫資料型別轉換錯誤)問題

不知道大家有沒有碰到過這樣一個報錯: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImp': Injection of reso

懶加載的解決方法(全)org.hibernate.LazyInitializationException: could not initialize proxy - no Session

close 修改 logs part 部門 pan 問題 org gin 如下錯誤:org.hibernate.LazyInitializationException: could not initialize proxy - no Session 原因是懶加載的問題,因為

【bug記錄】jpa 解決org.hibernate.lazyinitializationexception could not initialize proxy - no session

多人 java 事情 false 正文 disco ble www eal 前言 最近開發項目比較忙,springcloud的筆記得稍稍放放了,下午出來個bug,惡心的不行,功能很簡單,也沒有什麽級聯或復雜的映射關系,就是一直在報三個異常 Caused by: com.fa

could not resolve property: leader_id of: pojo.Project

IT con abstract ini warn info initial images log4j https://www.cnblogs.com/zhaocundang/p/9211270.html hibernate 雙向1對多 出現問題 外鍵解析錯誤! log4

org.hibernate.LazyInitializationException: could not initialize proxy [xxxx] - no Session異常

這是由於hiberante的懶載入機制出現的問題 以下在SpringBoot專案中的兩種解決方案 第一種是在實體類上加上註解 @Proxy(lazy = false) 第二種是在配置檔案application.properties中加入 spring.jpa.properti

Hibernate異常Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set

一:異常截圖 二:我的實體@Entity @Table(name = "p_user") public class User extends AbstractEntity { @Id @Gen

spring報“Could not resolve placeholder”錯誤

org.springframework.beans.factory.BeanDefinitionStoreException:  Invalid bean definition with name '******' defined in null: Could not r

org.hibernate.MappingException: Could not determine type for: java.util.List, at table: user, for...

異常詳情: Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at ta

org.hibernate.MappingException: Could not determine type for: java.lang.string

唉,糾結很久,看到一個帖子,很管用呀,問題解決了。貼上帖子原文: 我的對映檔案中是這樣寫的: <property                 name= "operatorName "                 type= "java.lang.Strin