【问题标题】:spring boot with hibernate and postgres giving exception column name not found even it is present带有hibernate和postgres的spring boot即使存在也找不到异常列名
【发布时间】:2022-09-30 21:10:08
【问题描述】:

我在带有postgres和hibernate的spring boot中使用如下本机查询。

@Query(value = \"SELECT json_data from xxxschema.roles where role_id =?1\", nativeQuery = true) 角色 getRolePrivilegesByRoleId(int id);

我收到以下错误,不知道为什么?

org.postgresql.util.PSQLException:在此 ResultSet 中找不到列名 role_id。 在 org.postgresql.jdbc.PgResultSet.findColumn(PgResultSet.java:2748) ~[postgresql-42.2.16.jar:42.2.16]

    标签: spring-boot hibernate spring-data-jpa


    【解决方案1】:

    您正在返回 Role,但不会返回映射到 Role 实体中的查询的所有列。

    【讨论】:

      猜你喜欢
      • 2020-07-03
      • 2020-11-13
      • 1970-01-01
      • 1970-01-01
      • 2013-01-08
      • 1970-01-01
      • 1970-01-01
      • 2017-12-11
      相关资源
      最近更新 更多