Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring jhipster:无法选择特定列_Spring_Angular_Jhipster - Fatal编程技术网

Spring jhipster:无法选择特定列

Spring 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

当我选择4列时,出现一个错误:

原因:org.postgresql.util.PSQLException:在此结果集中找不到列名id

@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)