2016-07-22 94 views
0

我收到以下错误:错误:关系“project文件”不Activejdbc存在即使表存在

org.javalite.activejdbc.DBException: org.postgresql.util.PSQLException: ERROR: relation "projectfile" does not exist 
    Position: 25, query: SELECT customer.id FROM projectfile LEFT JOIN project ON projectfile.project_id=project.id LEFT JOIN customer ON project.customer_id=customer.id WHERE (project.activity=6 OR project.activity=1) AND project.workflowmaxstatus='finish' AND project.workflowminstatus='finish' AND projectfile.type=1 AND projectfile.filename like '%.docx' AND project.startdate > NOW() - interval '2 months' GROUP BY customer.id 

这似乎抱怨表,但我双重检查和表是那里的公共架构。我看到有关这个主题的不同线程已经打开,但我找不到解决方案。

哪个是主要原因?

谢谢。

+0

您可以发布一个查询用于创建此表吗? – ipolevoy

+0

下面是该查询:查询字符串= “SELECT customer.id FROM project文件” + “LEFT JOIN项目ON projectfile.project_id = project.id” \t \t \t \t \t +“LEFT JOIN客户ON project.customer_id = customer.id “+” WHERE(project.activity = 6 OR project.activity = 1) “ \t \t \t \t \t +” AND project.workflowmaxstatus = '完成' “+” 和project.workflowminstatus = '结束'“ \t \t \t \t \t +“AND projectfile.type = 1 AND projectfile.filename like'%。” + format +“'AND project.startdate> NOW() - interval'”+ month +“months'GROUP BY customer.id”; customer_findBySQL(query); \t \t \t LazyList customerList = Customer.findBySQL(query); – csm86

回答

0

问题是,您从模型运行自由格式查询:Customer.findBySQL(query)。方法Model#findBySQL确实有局限性:

Ensure that the query returns all columns associated with this model so that the resulting models could hydrate themselves properly....

你根本不能在模型中使用这样的查询。你在这种情况下需要的是Base#findAllDB#findAll

tx

相关问题