java - 使用 spring-data jpa 阅读视图 - hibernate AUTO JPA 生成类型
问题描述
我有一个使用 Spring Data JPA 在 java 中读取的数据库视图。
class XView{
private Long id;
//Other column and constructors
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
}
因此,当我尝试阅读它时,它给了我以下错误:
Caused by: java.sql.SQLException: Invalid column name 'id'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:778)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:82)
... 56 common frames omitted
但生成它的主要目的是因为它不存在于视图中。
解决方案
推荐阅读
- traefik - Traefik 没有路由到某些容器的正确后端
- angular - Chrome 的跨域读取阻塞 (CORB) 阻止了跨域响应的离子
- ansible - 如何在单个“when”子句中检查 Ansible 循环任务的所有迭代的结果
- selenium-webdriver - 范围报告异常
- r - 将图片转换为 R 中的像素数据帧(EBImage lib)
- c# - 批处理请求必须具有“Content-Type”标头/“multipart/mixed”作为媒体类型
- multithreading - 从 while 循环中运行的线程获取值
- javascript - 在 CSS/Javascript 中创建加速度计
- javascript - ES6 JavaScript 中的括号
- bitbake - 运行 bitbake 时出现异常