【Hibernate】could not instantiate class.. from tuple] with root cause
使用hibernate的過程中出現了這個問題,查詢語句如下:
1 String hql = "select new GoodsBean(id, name, price, proPic, sales, updatetime, marketReferencePrice) from GoodsBean where bigTypeId = ? order by views desc"; 2 3 Query query = this.getCurrentSession().createQuery(hql); 4 query.setInteger(0, Integer.valueOf(bid));5 query.setFirstResult((p - 1) * pageSize); 6 query.setMaxResults(pageSize); 7 List<GoodsBean> goodsBeanList = (List<GoodsBean>)query.list();
執行到第七行時出現題目中的錯誤提示,最後在網上查詢資料,說是可能是入參為null,我看了下資料庫建構函式中的各引數,果真有一個引數的值為空,賦值後,正常了。
1 new GoodsBean(id, name, price, proPic, sales, updatetime, marketReferencePrice)
參考:https://blog.csdn.net/sunzhemin/article/details/9214435?locationnum=9
相關推薦
【Hibernate】could not instantiate class.. from tuple] with root cause
使用hibernate的過程中出現了這個問題,查詢語句如下: 1 String hql = "select new GoodsBean(id, name, price, proPic, sales, updatetime, marketReferencePrice) from GoodsBean wh
【原】Could not initialize class org.apache.log4j.Log4jLoggerFactory
考題 ted log clas .com alt 代碼 light nbsp 現象:正常運行的項目,從Jenkins遷到容器雲上不能正常啟動,報錯誤如下: Caused by: java.lang.NoClassDefFoundError: Could not ini
【Redis】Could not get a resource from the pool 實乃叢集配置問題
先說些題外話~自上次確診為鼻竇炎+過敏性鼻炎到現在已經一個月了,最初那會,從下午到晚上頭疼難忍。大概是積勞成疾,以前流鼻涕、打噴嚏的時候從來沒有注意過,結果病根一下爆發。 關鍵在於鎖定問題,開始治療一兩天之後就不會頭疼了。當然,習慣也很重要,再也不敢用力擤鼻子了。 挺過那一陣就好受很多,之後就是鼻塞稍微煩
【bug】Could not find method compile() 解決
整合第三方庫出現 Error:Could not find method compile() for arguments [com.android.support:design:23.4.0] on DefaultExternalModuleDependency{g
Mybatis 模糊查詢 like【筆記】Could not set parameters for mapping
當使用mybatis 做模糊查詢時如果這樣寫會報 Could not set parameters for mapping: ParameterMapping{property='keywords'# 是起的佔位符的作用,但是寫在了字串裡面無法起到佔位符的作用,這是我們要用
MyBatis日誌log4j異常ERROR Could not instantiate class [org.apache.ibatis.session.AutoMappingUnknownColum
具體異常: log4j:ERROR Could not instantiate class [org.apache.ibatis.session.AutoMappingUnknownColumnBeh
【bug記錄】jpa 解決org.hibernate.lazyinitializationexception could not initialize proxy - no session
多人 java 事情 false 正文 disco ble www eal 前言 最近開發項目比較忙,springcloud的筆記得稍稍放放了,下午出來個bug,惡心的不行,功能很簡單,也沒有什麽級聯或復雜的映射關系,就是一直在報三個異常 Caused by: com.fa
【Android】匯入第三方jar包Could not find class 異常解決
這幾天做一個通訊錄APP,在漢字排序的時候用到了開源專案pinyin4j,在java project中使用正常,無奈在android project中總是報異常 下面給出解決方法: 1、在工程目錄下新建一個externLib資料夾,將jar包拷貝到該資料夾 重新整理之後會
【解決方法】Could not find the main class Program will exit
問題背景: 從別人那考的程式,工程上出現紅歎號,於是修改了一下Java Build Path中的jdk版本(原來是1.5的,我沒有1.5,就給改成1.6了)。 開發環境: eclipse + jdk1.6 + jdk1.7(我裝了兩個jdk) 錯誤原因: 可能
【odoo10】Refused to execute script from '*' because its MIME type ('text/plain') is not executable
軟體環境:window10 編譯環境:python2.7.9,pycharm4.5.3 ,nodejs6.9 問題描述:當開發環境搭建成功,啟動odoo9或者odoo10後(已建立資料庫),登陸訪問報錯如下 web:1 Refused to execute script from '*/w
jnhs-java實體類的有參構造器 無參構造器Could not instantiate bean class 實體類No default constructor found
new一個物件的時候要用到建構函式, 例如Hello hello = new Hello();這時呼叫的是Hello的無引數構造方法; Hello hello = new Hello("hi");這個是呼叫Hello有引數構造方法, 在JAVA中如果不寫構造方法的話,會預設加上一個無引數的構
【Hibernate】Unable to locate appropriate constructor on class原因分析
通常我們喜歡將hql查詢結果封裝到POJO物件syntax:select new POJO(id,name) from POJO ; 這種封裝需要POJO類提供對應構造器,POJO(id,name)構造方法。 但使用中經常會拋這樣的異常:Unable to locate appropriate const
BeanInstantiationException Could not instantiate bean class [User]Is it an abstract class?;
錯誤資訊如下 org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.com.day03.User]: Is it an abstract class
【Hibernate】Hibernate3.x獨立執行時的Failed to load class "org.slf4j.impl.StaticLoggerBinder"錯誤
按理說,如果Hibernate不依附於SSH執行,像《【Struts2+Hibernate3+Spring3】利用SSH整合,完成列印使用者表,使用者登入、註冊、修改密碼系統》(點選開啟連結)一樣,把hibernate-distribution-3.6.10.Final解壓
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
【已解決】Could not get unknown property 'packageForR' for task ':app:processDebugResources'
匯入專案報錯: Could not get unknown property 'packageForR' for task ':app:processDebugResources' of type com.android.build.gradle.inter
【轉】Caused by: Action class [com.struts.action.xxxAction] not found 解決方法
剛學習Struts,自己寫了個簡單程式,一啟動tomcat就報錯,但是我按著ctrl點選struts.xml中com.struts.action.LoginAction也能定位到LoginAction類,自己弄了半天,網上找了好久終於搞定了! 控制檯報錯:[
【已解決】Could not get unknown property 'packageForR' for task ':app:processDebugResources'
Android Studio 升到3.1, Grable 使用的是: classpath 'com.android.tools.build:gradle:3.0.1'butterknif 使用的是:8.5.1編譯時報錯:Could not get unknown pro
Hibernate提示 Could not parse mapping document from resource...
今天使用Hibernate學習one-to-one的關係對映,執行時一直提示: Could not parse mapping document from resource... 無法解析物件關係對映檔案,一定是某個物件關係對映檔案出問題了,仔細對照了各項配置感覺沒有問題
使用Eclipse的hibernate外掛進行工程反轉生成po類Could not initialize class org.hibernate.cfg.reveng.OverrideReposity
hibernate外掛是適合Eclipse版本的最新版本,工程反轉使用的hibernate3.6 使用Eclipse的hibernate外掛進行工程反轉生成po類時報錯: org.hibernate.console.HibernateConsoleRun