【问题标题】:jhipster : unable to select specific columnsjhipster:无法选择特定列
【发布时间】:2018-07-19 09:33:25
【问题描述】:

当我选择 4 列时发生错误:

原因:org.postgresql.util.PSQLException:在此 ResultSet 中找不到列名 id。

@Query(value = "select name,rating,numberofviews,status from learningunit", nativeQuery = true)
List<Learningunit> findAllData();

然后我将 id 添加到查询中,不同的列会出现相同的错误,依此类推

@Query(value = "select id,name,rating,numberofviews,status from learningunit", nativeQuery = true)
List<Learningunit> findAllData();

原因:org.postgresql.util.PSQLException:列名摘要 在此 ResultSet 中找不到。

注意:我使用 jhipster 并且曾经实体有一个 dto 和映射器

实体

DTO 映射器

【问题讨论】:

  • @JonRuddell 我用这个查询解决了这个问题@Query(value = "select null as id , name,rating,numberofviews,null as status from learningunit", nativeQuery = true)

标签: spring angular jhipster


【解决方案1】:

终于我使用这个查询@Query(value = "select null as id , name,rating,numberofviews,null as status from learningunit", nativeQuery = true) 解决了这个问题

重点是选择null为the name of your column

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-03
    相关资源
    最近更新 更多