简体   繁体   中英

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

The query h wever works fine. I am guessing it has to do with the anorm framework expecting to find Instruction table in the database.

What I want basically to do is execute a parameterized query in anorm and retrieve and parse the results.

How do I go about doing that?

Thanks

Got it.

You simply have to disable the evolutions plugin from the play configuration file.

Just add to the configuration:

evolutionplugin=disabled

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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