Unable to locate appropriate constructor on class报错
在项目开发中,使用Hibernate里的JPA criteria查询,但是在写完之后使用时,会报错:Unable to locate appropriate constructor on class,网上搜索不少说是因为构造函数类型错误导致的,于是仔细检查了定义的数据类,发现并没有错误的类型。
于是继续查看报错,发现报错里还有:Expected arguments are: long, java.lang.String, java.lang.String, java.lang.String,然后仔细看了下,这个类型的顺序是我在查询语句中获取字段的顺序,然后发现这个顺序跟我定义数据类的顺序不一样,这就尴尬了,然后又网上搜索了一圈,发现有篇博文里提到这么一句话:SQL语句的字段顺序一定要与实体类字段的顺序保持一致,否则会出现参数封装错误的情况。
这不就是我的报错吗,于是改了下自己查询sql语句中字段的顺序,保持跟数据实体类定义的顺序一致,再运行项目,果然就没有报错了,这个坑真是囧。
Unable to locate appropriate constructor on class报错的更多相关文章
- Hibernate异常:Unable to locate appropriate constructor on class
异常信息:org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class o ...
- Unable to locate appropriate constructor on class异常
一般出现Unable to locate appropriate constructor on class这个异常,都是实体类的带参数的构造方法和使用查询语句出现偏差,两个地方的代码如下: 一般都是第 ...
- 【Hibernate】Unable to locate appropriate constructor on class原因分析
通常我们喜欢将hql查询结果封装到POJO对象syntax:select new POJO(id,name) from POJO ; 这种封装需要POJO类提供对应构造器,POJO(id,name)构 ...
- SpringBoot项目 org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Jetty servlet container报错
SpringBoot项目启动报错 ERROR 2172 --- [ main] o.s.boot.SpringApplication : Application startup failed org. ...
- 出现Unable to locate appropriate constructor on class 错误可能的原因
1)参数构造器的参数类型是否正确2)参数构造器的顺序和hql中的顺序是否一致3)参数构造器的参数个数是否和hql中的个数一致4)参数构造器的参数类型是否TimeStamp
- 关于“java.lang.OutOfMemoryError : unable to create new native Thread”的报错问题
好吧 我发誓这是postgresql的Mirroring Controller的RT测试的最后一个坑了. 在这个RT测试的最后,要求测试Mirroring Controller功能在长时间运行下的稳定 ...
- laravel5.6 发送邮件附带邮件时,Unable to open file for reading,报错文件路径问题
https://stackoverflow.com/questions/48568739/unable-to-open-file-for-reading-swift-ioexception-in-la ...
- OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "ip": executable file not found in $PATH: unknown (Docker容器没有ip addr命令:exec ip addr 报错)
一.报错 1.报错信息1: OCI runtime exec failed: exec failed: container_linux.go:380: starting container proce ...
- [Linux]Centos git报错fatal: HTTP request failed
在使用git pull.git push.git clone会报类似例如以下的错误: error: The requested URL returned error: 401 Unauthorized ...
随机推荐
- Echart横坐标时间轴滑动
主要针对于dataZoom的使用,代码如下: option = { title: { text: '未来一周气温变化', subtext: '纯属虚构' }, tooltip: { trigger: ...
- Vue通过路由 query传递参数
父组件通过query来传递num参数为1,相当与在 url 地址后面拼接参数 <template> <div> <h3>首页</h3> <rout ...
- day-13装饰器
函数的嵌套定义 概念:在一个函数的内部定义另一个函数 为什么要有函数的嵌套定义:1)函数fn2想直接使用fn1函数的局部变量,可以将fn2直接定义到fn1的内部,这样fn2就可以直接访问fn1的变量2 ...
- 20165308『网络对抗技术』Exp5 MSF基础应用
20165308『网络对抗技术』Exp5 MSF基础应用 一.原理与实践说明 实践内容 本实践目标是掌握metasploit的基本应用方式,重点常用的三种攻击方式的思路.具体需要完成: 一个主动攻击实 ...
- is_numeric — 检测变量是否为数字或数字字符串
is_numeric — 检测变量是否为数字或数字字符串 bool is_numeric ( mixed $var ) 如果 var 是数字和数字字符串则返回 TRUE ,否则返回 FALSE . 参 ...
- CWMP开源代码研究6——libcwmp动态库开发
原创作品,转载请注明出处,严禁非法转载.如有错误,请留言! email:40879506@qq.com 为了使程序具有通用性,便于扩展和维护.采用了"模块"插入的思想.将设备业务相 ...
- 音频格式软件 GoldWave 支持V3
版本:GoldWave v5.67 md5:36E78BE278908B6538CE24D41A6859BA sha1:36A00003562F071670588D29E573B2FB0D8FF40A ...
- dm_analysis
# -*- coding: utf-8-*- # import sys import os import io import json reload(sys) sys.setdefaultencodi ...
- bootloader介绍
Bootloader是系统加电后运行的第一段软件代码,主要任务就是将内核映像从硬盘读到RAM中,然后跳转到内核的入口点去运行,也即开始启动操作系统. 简单的说,Bootloader就是在操作系统运行内 ...
- __unsafe_unretained的含义
OC的变量限定词的官方解释: __strong is the default. An object remains “alive” as long as there is a strong point ...