ColumnNotFound Magic issue in scala

I get "play.exceptions.JavaExecutionException: ColumnNotFound (comments.id)" in a piece of code after trying to switch to MySql instead of memorydb. Magic's Postgres support is almost null. Evolution:

create table comments ( 
    id bigint(20) NOT NULL AUTO_INCREMENT, 
    source varchar(255) NOT NULL, 
    target varchar(255) NOT NULL, 
    content text NOT NULL, 
    date bigint NOT NULL, 
    PRIMARY KEY (id) 
); 

Model:

case class comments(id: Pk[Long], source: String, target: String, 
content: String, date: Long) { 
  override def toString = "|%s| |%s|, |%s|, |%s|".format(id.toString, 
source, target, content) 
  lazy val formattedDate = new SimpleDateFormat("dd.MM.yyyy HH:mm") 
format date 
} 

object comments extends Magic[comments] 

And the code snippet:

def loadComments(username: String) = SQL("""select c.*, u.* from 
comments c, usr u where c.source = u.ccall and c.target = {ccall} 
order by c.date desc""").on("ccall" -> username).as(comments ~< usr *) 

Can someone give me some pointers? I am really stuck with this. Here is a stack:

play.exceptions.JavaExecutionException: ColumnNotFound(comments.id)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:228)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.RuntimeException: ColumnNotFound(comments.id)
    at scala.Predef$.error(Predef.scala:58)
    at play.db.anorm.Sql$.as(Anorm.scala:984)
    at play.db.anorm.Sql$class.as(Anorm.scala:919)
    at play.db.anorm.SimpleSql.as(Anorm.scala:829)
    at controllers.Profile$.loadacomments(Profile.scala:21)
    at controllers.Profile$.loadacommentsWithLikes(Profile.scala:46)
    at controllers.Profile$.comment(Profile.scala:91)
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:543)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:499)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:493)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:470)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:158)

Thank!

+5
source share
3 answers

In this particular case, the mysql driver was old, which made the names really weird. I just updated the driver and everything is back in place.

google : http://groups.google.com/group/play-framework/browse_thread/thread/3bd8d3ccb5a51d10/e7074ad34ac637da?lnk=gst&q=Jos%C3%A9+Leal#e7074ad34ac637da

+2

, ? ?

, . Anorm Postgres. Anorm, < column name > < > . < > . , Anorm , JOIN. .

scala github, , .

0

, , , Table1., Table2., ... , "ID",

ID_A, ID_B ..... . , USR "ID", , .

, USR ...

C.ID MyCTableID, C., U....

, "MyCTableID" .

0

All Articles