数据未能以正确的格式从数据库中使用Hibernate获取

huangapple 未分类评论45阅读模式
英文:

data not getting fetched from database using hibernate in correct format

问题

我想使用Hibernate HQL从数据库中获取学生数据列表,但在运行代码后,数据没有以正确的形式获取,而是返回了其他内容,并且没有出现错误。
以下是附加的代码和输出:

程序图片

输出图片

英文:

i want to fetch a list of student data from database using hibernate HQL but after running the code data is not getting fetched in correct form and instead returning something else and there are no errors.
Here is the attached code and output

program image

output image

答案1

得分: 0

你正在执行:

System.out.println(s);

Student类没有重写toString()方法,因此你看到的是Java默认的toString()方法,它会打印类名和引用。

你必须在Student类中实现toString()方法以查看其他信息。

英文:

You are doing:

System.out.println(s);

Student has not overridden toString() method therefore you see the Java default toString() method that prints the class name and the reference.

You must implement toString() on the Student class to see anything else.

huangapple
  • 本文由 发表于 2020年5月3日 17:10:01
  • 转载请务必保留本文链接:https://java.coder-hub.com/61572049.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定