当前位置:网站首页>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
边栏推荐
- 二叉树可视化
- 微信小程序开发之网络数据请求
- what is qml in qt
- Analysis of CMS station building system of common PHP in China
- Hongmeng - Damiao computing Sketchpad - VIDEO
- Hongmeng - Damiao computing Sketchpad - Introduction
- 什么是唯心主义
- Skiing mobile H5 game source code download
- Basic practice of Blue Bridge Cup - shape retrieval of matrix (C language)
- 基于海思3559 高效率的 0延时 0拷贝 qt播放器方案
猜你喜欢

手机端触摸图片slider轮播插件photoswipe.js

AAAI 2022 | GAN的结构有“指纹”吗?从伪造图像溯源生成网络结构

微信小程序 26 播放音乐页的完善②

leetcode刷题:动态规划07(不同的二叉搜索树)

binarySearch基础二分查找

Why learn service grid istio

Use of swift basic codable (jsonencoder jsondecoder)

微信小程序开发之WXSS模板样式与WXS脚本语言

Istio exposes applications to the Internet
![[artifact] screenshot + mapping tool snipaste](/img/d2/a9a706a114641094e32ab5c6193f58.png)
[artifact] screenshot + mapping tool snipaste
随机推荐
Split very long line of words into separate lines of max length
485 current acquisition module dam-8041
微信小程序10-微搭模板
[wp]ctfshow-web introductory information collection
Concept of IP address
安全基础6 ---漏洞复现
Selenium runs slowly - speed up by setting selenium load policy
Small program completion work wechat campus maintenance application small program graduation design finished product (2) small program function
加州大学|用于未指定环境的可行对抗鲁棒强化学习
A good way to generate interface documents efficiently
Network packet multi-layer transmission demonstration
打印数据库返回的查询数据是null,或者是默认值。与数据库返回的值不相符
Wechat campus maintenance and repair applet graduation design finished product of applet completion work (4) opening report
Skiing mobile H5 game source code download
Eve - 0day Threat Intelligence
Use of swift basic codable (jsonencoder jsondecoder)
Empire CMS whole station | mobile number /qq lianghao mall source code | suitable for mobile terminal
Improvement of wechat applet 29 hot search list ②
微信小程序 28 热搜榜的完善①
Bash does not add single quotes to your string