简体   繁体   中英

Play Scala Anorm “Magic[Country]().using(”Countries“)”

In looking at the docs for Play Scala Anorm, they show specifying a alternate table name as using this syntax:

object Country extends Magic[Country]().using("Countries")

When i try to use this i get:

Error raised is : ';' expected but '.' found.

What is the correct Scala syntax for this to work?

Well there is an error in the example. You can do

val Country = new Magic[Country]().using("Countries")

but you certainly cannot do that with an object declaration You can use another constructor of Magic

object Country extends Magic[Country](Some("Countries"))

(see object User extends Magic[User]().using("users") can not compiled )

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