当前位置:网站首页>The query data returned by the print database is null or the default value. Does not match the value returned by the database
The query data returned by the print database is null or the default value. Does not match the value returned by the database
2022-07-25 19:38:00 【Laugh like a mockery】
Test environment IDEA2021
When printing the class average , I found that the average score of all classes is 0.0

I checked it first SQL sentence , Make sure there are no errors
public List<ClassAvgScore> queryClassAvgScore(){
return scoreDAO.QueryMany("SELECT ClassRoom,AVG(score) AS score FROM Student GROUP BY ClassRoom ORDER BY ClassRoom ASC,AVG(score)DESC;",ClassAvgScore.class);
}Database student table

It took a long time to find the mapping class attribute name used to receive the query results ( I don't know what to call it ) Write the wrong . It is not the same as the column name of the database table
private int ClassRoom;
private double AvgScore;
public double getAvgScore() {
return AvgScore;
}
public void setAvgScore(double avgScore) {
AvgScore = avgScore;
}
public int getClassRoom() {
return ClassRoom;
}What is written in the mapping class is AvgScore The column name of the database table is score Data cannot be loaded .
terms of settlement
Change the attribute name in the mapping class to be the same as the column name of the database table
Be careful : My search statement renames the column name as score , Therefore, the attribute name of the mapping class should be changed to the renamed name instead of the column name of the table ( Although the column name of my renamed table is the same as that of the original table , Ha ha ha ). Just pay attention
边栏推荐
- 微信小程序10-微搭模板
- Creative drop-down multi choice JS plug-in download
- balanced binary tree
- University of California | feasible confrontation robust reinforcement learning for unspecified environments
- what is qml in qt
- 什么是唯心主义
- 阿姆利塔工程学院|用于情感分析的方面术语提取中优化采样的强化主动学习方法
- Internal network planning and design of Yingcheng hospital
- binarySearch基础二分查找
- [wp]ctfshow-web introductory information collection
猜你喜欢
![[wp]ctfshow-web入门-爆破](/img/4b/6d8f4c044578382b9353d4d1c69c8f.png)
[wp]ctfshow-web入门-爆破

【神器】截图+贴图工具 Snipaste

哪吒 D1-H 测试 microbench

网络数据包多层传输演示

Talk about 11 tips for interface performance optimization

Old wine in new bottles -- sample analysis of recent apt32 (sea Lotus) organizational attacks

The finished product of wechat campus maintenance and repair applet graduation design (1) development outline

基于海思3559 高效率的 0延时 0拷贝 qt播放器方案

Why learn service grid istio

binarySearch基础二分查找
随机推荐
Dynamic implementation of wechat applet 27 progress bar and static construction of search box and hot search list
TypeError: ‘str‘ object is not callable的错误原因
VMware virtual machine download, installation and use tutorial
重磅!《几何深度学习》新书发布,帝国理工/DeepMind等图ML大牛共同撰写,160页pdf阐述几何DL基础原理和统一框架
Network design and planning of a company
Leetcode skimming: dynamic programming 07 (different binary search trees)
Old wine in new bottles -- sample analysis of recent apt32 (sea Lotus) organizational attacks
Improvement of wechat applet 26 playing music page ②
C语言学习日记3——realloc函数
Improvement of wechat applet 29 hot search list ②
Global configuration and page configuration of wechat applet development
919. 完全二叉树插入器
[wp]ctfshow-web getting started - Explosion
新瓶装老酒--近期APT32(海莲花)组织攻击活动样本分析
连接数据库警告 Establishing SSL connection without server‘s identity verification is not recommended.
Code sharing of social chat platform developed by dating website (III)
InTouch advanced alarm (alarm filtering)
Basic practice of Blue Bridge Cup - shape retrieval of matrix (C language)
【刷题记录】21. 合并两个有序链表
【HDLBits 刷题】Verilog Language(3)Modules: Hierarchy 部分