Spring jhipster:无法选择特定列
当我选择4列时,出现一个错误: 原因:org.postgresql.util.PSQLException:在此结果集中找不到列名idSpring jhipster:无法选择特定列,spring,angular,jhipster,Spring,Angular,Jhipster,当我选择4列时,出现一个错误: 原因:org.postgresql.util.PSQLException:在此结果集中找不到列名id @Query(value = "select name,rating,numberofviews,status from learningunit", nativeQuery = true) List<Learningunit> findAllData(); @Query(value=“选择名称、评级、numberofviews、learningun
@Query(value = "select name,rating,numberofviews,status from learningunit", nativeQuery = true)
List<Learningunit> findAllData();
@Query(value=“选择名称、评级、numberofviews、learningunit中的状态”,nativeQuery=true)
列出findAllData();
然后我将id添加到查询中,相同的错误会出现在不同的列中,以此类推
@Query(value = "select id,name,rating,numberofviews,status from learningunit", nativeQuery = true)
List<Learningunit> findAllData();
@Query(value=“选择id、名称、评级、numberofviews、learningunit的状态”,nativeQuery=true)
列出findAllData();
原因:org.postgresql.util.PSQLException:列名摘要
在此结果集中找不到
@Query(value = "select name,rating,numberofviews,status from learningunit", nativeQuery = true)
List<Learningunit> findAllData();
注意:我使用的jhipster和ever实体有dto和映射器
实体
DTO
制图员
最后我使用这个查询@query解决了这个问题(value=“选择null作为id、name、rating、numberofviews、null作为learningunit的状态”,nativeQuery=true)
关键是选择null作为列的名称,请参见@JonRuddell,我使用这个查询@query解决了这个问题(value=“选择null作为id、名称、评级、numberofviews,从learningunit中选择null作为状态”,nativeQuery=true)