今天在做一个功能的时候
遇到了。一个Could not resolve property 的问题。
配置文件如下:
<many-to-one name="user" class="Users" column="StudentExam_user_fid" cascade="all" ></many-to-one>
查询代码:
Criteria crt = session.createCriteria(StudentExam.class).add(Restrictions.eq("exam.id", ExamId)).add(
Restrictions.eq("reading", reading)).add(Restrictions.like("user.truename", name));
return crt.setFirstResult(start).setMaxResults(max).list();
在网上找了好久。所有人给的理由都是“对照配置文件以及实体类,是否写错了字段名称”
在我一再的确认下,字段名称没有任何错误……
而且使用user.id是可以进行查询的。除了这个以外。别的都不可以用!
于是开始对配置文件进行修改。尝试了 lazy设置为false 等等。。想对应的修改
Users配置文件的修改。未果
最后,经过各种挣扎。以及Hibernate相关API的查找。最终终于找出解决办法
Criteria crt = session.createCriteria(StudentExam.class).add(Restrictions.eq("exam.id", ExamId)).add(
Restrictions.eq("reading", reading)).createCriteria("user").add(Restrictions.like("truename", name));
对。就是这样写。在使用完StudentExam里的属性后。
.createCriteria("user")
设置到user实体里。然后再选择属性
注:这里的user是StudentExam类中的名称
分享到:
相关推荐
按官方配置好了 developer.... Could not resolve com.huawei.agconnect 解决方法:把相应的插件用本地化安装 agconnect-crash-symbol-lib-1.6.1.300.jar agconnect-apms-plugin-1.6.1.300.jar agcp-1.6.1.300.jar。
`org.hibernate.QueryException: could not resolve property: isStudent of: com.zluo.hibernate.po.User [from com.zluo.hibernate.po.User u where u.isStudent = ?]` 当时就在想怎么会出现这个错误呢,
myeclipse创建maven工程报错 Could not resolve
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ‘:classpath’. 提示错误:Read Time out ...
Could not resolve all dependencies for configuration ‘:classpath’. Could not resolve com.android.tools.build:gradle:2.1.2. ………. 等6个error 上网百度csdn,结果试下各种方法,依旧没用。 搞了一天,...
[INFO] ———————————————————————— [INFO] Reactor Summary for demo 0.0.1-SNAPSHOT: [INFO] [INFO] demo ……………………………………….. FAILURE [18:18 min] [INFO] admin-service ...
hive 开发UDF 使用maven工程 引发jar包缺失 hive 开发UDF 使用maven工程 引发jar包缺失
Android Studio更新3.6.3之后出现Could not resolve all artifacts for configuration ‘:classpath’.问题你是否和我一样,只因在人群中多看了他一眼?![在这里插入图片描述]...
主要介绍了解决Unable to access 'https://gitee.com/自己的项目/': Could not resolve host: gitee.com问题,需要的朋友可以参考下
新建maven项目时报Could not resolve archetype org.apache.maven.archetypes
Error:Could not resolve all files for configuration ‘:app:debugCompileClasspath’. > Could not resolve com.android.support:appcompat-v7:26.0.0-beta1. Required by: project :app > Could not ...
Hibernate映射导致的几个常见异常
Microsoft OLE DB Provider for ODBC Drivers 错误'80040e4d'[Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identifier specified. 使用PL-SQL Developer能连接上Oracle,但是ASP+ODBC连不上...
Eclipse Maven 创建Web 项目报错 Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webap 之前找了很久才找到了,传上来更大家共享下,希望对大家有帮助,欢迎下载或者永久保存。
Could not resolve all files for configuration ':jcore-react-native:lintClassPath'. > Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15) > Could not get resource '
安卓调取usb摄像头的工具类,包含了之前版本删除掉的类,解决:libusbcamera@debug/compileClasspath': Could not resolve com.serenegiant:common:1.5.20.报错问题,需要配合repository文件夹使用
opencv4.1.0使用cmake编译时,提示FFMPEG: Download failed: 6;"Couldn't resolve host name
build时出现错误Could not resolve nl.eveoh:gradle-aspectj:1.6。将此文件放入此目录下即可.m2\repository\nl\eveoh\gradle-aspectj\1.6
网上下载的开源SSL服务器扫描代码。 依赖与openssl库。 超级好用啊,精华之作。
asm-analysis-5.0.3.jar;asm-analysis-5.0.3.jar;asm-analysis-5.0.3.jar