nested exception is org.hibernate.PropertyNotFoundException: no appropriate constructor in class

本文主要是介绍nested exception is org.hibernate.PropertyNotFoundException: no appropriate constructor in class,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 查询出的VO和 要 从javaBean中的属性的类型不对应,比如 我的 ApiRailWorkAccessOpenVo中id的属性为String

而RailWorkInfo中的id为Long,所以报错。

String hsql_open = "select new com.rail.po.vo.ApiRailWorkAccessOpenVo(t.id,t.workStatus,t.workStart,t.workCode,t.workTeam,t3.workTeamName) "+ " from RailWorkInfo  t ,RailWorkEmployee t2,RailTeam t3 "+ " where   t.workCode = t2.workCode  and t.workTeam = t3.id "+ " and  t.dept = '"+dept+"'"+ " and t2.emplpoyeeCode = '"+employeeCode+"'"
List<ApiRailWorkAccessOpenVo> lisAccessOpenVos = this.getHibernateTemplate().find(hsql_open);//有开门权限的员工工单信息
String whseCodeWhere = getWhseCodeWhere(whseCode);//获取下级仓库编码
String sql = "select new java.lang.String(t2.equipCode) from RailAccessInfo t ,RailAccessEquipInfo t2 " +"where t.accessCode = t2.accessCode and t.whseCode in "+whseCodeWhere;

直接用String 也是可以的。哈哈

这篇关于nested exception is org.hibernate.PropertyNotFoundException: no appropriate constructor in class的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/624287

相关文章

java面试常见问题之Hibernate总结

1  Hibernate的检索方式 Ø  导航对象图检索(根据已经加载的对象,导航到其他对象。) Ø  OID检索(按照对象的OID来检索对象。) Ø  HQL检索(使用面向对象的HQL查询语言。) Ø  QBC检索(使用QBC(Qurey By Criteria)API来检索对象。 QBC/QBE离线/在线) Ø  本地SQL检索(使用本地数据库的SQL查询语句。) 包括Hibern

org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结

org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select u from User u where u.userName=:userName and u.password=:password] 上面的异常的抛出主要有几个方面:1、最容易想到的,就是你的from是实体类而不是表名,这个应该大家都知道,注意

Caused by: org.hibernate.MappingException: Could not determine type for: org.cgh.ssh.pojo.GoodsType,

MappingException:这个主要是类映射上的异常,Could not determine type for: org.cgh.ssh.pojo.GoodsType,这句话表示GoodsType这个类没有被映射到

Hibernate框架中,使用JDBC语法

/*** 调用存储过程* * @param PRONAME* @return*/public CallableStatement citePro(final String PRONAME){Session session = getCurrentSession();CallableStatement pro = session.doReturningWork(new ReturningWork<C

hibernate修改数据库已有的对象【简化操作】

陈科肇 直接上代码: /*** 更新新的数据并并未修改旧的数据* @param oldEntity 数据库存在的实体* @param newEntity 更改后的实体* @throws IllegalAccessException * @throws IllegalArgumentException */public void updateNew(T oldEntity,T newEntity

类型信息:反射-Class

在说反射前提一个概念:RTTI(在运行时,识别一个对象的类型) public class Shapes {public static void main(String[] args) {List<Shape> shapes = Arrays.asList(new Circle(), new Square(), new Triangle());for (Shape shape : shapes

react笔记 8-17 属性绑定 class绑定 引入图片 循环遍历

1、绑定属性 constructor(){super()this.state={name:"张三",title:'我是一个title'}}render() {return (<div><div>aaaaaaa{this.state.name}<div title={this.state.title}>我是一个title</div></div></div>)} 绑定属性直接使用花括号{}   注

Hibernate插入数据时,报错:org.springframework.dao.DataIntegrityViolationException: could not insert: [cn.itc

在用junit测试:插入数据时,报一下错误: 错误原因: package junit;import org.junit.Test;import cn.itcast.crm.container.ServiceProvinder;import cn.itcast.crm.dao.ISysUserDao;import cn.itcast.crm.domain.SysRole;

Hibernate中自带的连接池!!!

<span style="font-size:18px; font-family: Arial, Helvetica, sans-serif;"><?xml version="1.0" encoding="UTF-8"?></span> <span style="font-size:18px;"><!DOCTYPE hibernate-configuration PUBLIC"-//Hibern

Java构造和解析Json数据的两种方法(json-lib构造和解析Json数据, org.json构造和解析Json数据)

在www.json.org上公布了很多JAVA下的json构造和解析工具,其中org.json和json-lib比较简单,两者使用上差不多但还是有些区别。下面首先介绍用json-lib构造和解析Json数据的方法示例。 一、介绍       JSON-lib包是一个beans,collections,maps,java arrays 和XML和JSON互相转换的包,主要就是用来解析Json