[英]Anorm query throws ORA-00942: table or view does not exist
I have created a case class and a companion object to execute a query, as follows: 我创建了一个case类和一个伴随对象来执行查询,如下所示:
case class Instruction(caseid:Long, day:String, period:String)
object Instruction{
val rt = {
get[Long]("caseid") ~
get[String]("day") ~
get[String]("period") map{
case caseid~day~period => RealTimeInstruction(caseid, day,period)
}
}
def findAll(date:String):List[RealTimeInstruction]={
DB.withConnection{
implicit c => SQL("""
select
unit.CASEID "CASEID",
to_char(c.GETLOCALDATE(unit.START_TIME), 'DD-MON-YY') as "DAY",
case when to_char(c.GETLOCALDATE(unit.START_TIME), 'HH24') LIKE '0%'
then to_number(substr(to_char(c.GETLOCALDATE(unit.START_TIME), 'HH24'),2))
else to_number(to_char(c.GETLOCALDATE(unit.START_TIME), 'HH24'))
end "PERIOD"
from unit, entity_def, entity
........
""").on('date->date).as(rt *)
}
}
}
Executing findAll yields ORA-00942: table or view does not exist 执行findAll会产生ORA-00942:表或视图不存在
The query h wever works fine. 查询h wever可以正常工作。 I am guessing it has to do with the anorm framework expecting to find Instruction table in the database.
我猜想这与期望在数据库中找到指令表的anorm框架有关。
What I want basically to do is execute a parameterized query in anorm and retrieve and parse the results. 我基本上想要做的是在anorm中执行参数化查询,并检索和解析结果。
How do I go about doing that? 我该怎么做?
Thanks 谢谢
Got it. 得到它了。
You simply have to disable the evolutions plugin from the play configuration file. 您只需从播放配置文件中禁用Evolutions插件即可。
Just add to the configuration: 只需添加到配置:
evolutionplugin=disabled evolutionplugin =禁用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.