简体   繁体   English

java.sql.SQLException: 列 'n_id_proyecto_categoria_has_proyecto' 未找到,查询 hibernate

[英]java.sql.SQLException: Column 'n_id_proyecto_categoria_has_proyecto' not found, query hibernate

I am trying to execute a native query in hibernate, but when it runs it gives me the title error.我正在尝试在 hibernate 中执行本机查询,但是当它运行时它给了我标题错误。 The query is not the problem since I execute it without problems in workbench, I don't know if the query notation changes in hibernate, I leave part of my code查询不是问题,因为我在工作台中执行它没有问题,我不知道 hibernate 中的查询符号是否发生变化,我留下了部分代码

@Query(value = "SELECT * FROM proyecto_categoria " + 
            "WHERE c_nombre not in (SELECT c_nombre as 'Nombre categoria' FROM proyecto_categoria_has_proyecto INNER JOIN proyecto_categoria " + 
            "ON proyecto_categoria_has_proyecto.n_id_categoria = proyecto_categoria.n_id_categoria " + 
            "WHERE n_id_proyecto = :idProyecto and n_status = 1)", nativeQuery = true)
    public ArrayList<ProyectoCategoriaHasProyecto> findAllByProyectoIdNotIn(@Param("idProyecto") long idProyecto);

the query in your question doesn't have the column n_id_proyecto_categoria_has_proyecto so maybe the error is called by another query in your code... can you add the error log and the rest of the code so it becomes clearer to determine your problem.您问题中的查询没有 n_id_proyecto_categoria_has_proyecto 列,因此您的代码中的另一个查询可能调用了该错误...您可以添加错误日志和代码的 rest 以便更清楚地确定您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM