在yabe示例中,有一个查询:
def allWithAuthor:List[(Post,User)] =
SQL(
"""
select * from Post p
join User u on p.author_id = u.id
order by p.postedAt desc
"""
).as( Post ~< User ^^ flatten * )
在我的应用中,我有一个非常相似的查询:
def findAll:List[(Album,Artist)] =
SQL(
"""
select * from Album al
join Artist ar on al.artist_id = ar.id
order by al.nbVotes desc
limit 100
"""
).as( Album ~< Artist ^^ flatten * )
我有这个编译错误:
The file /app/models.scala could not be compiled. Error raised is : not found:
value flatten Error occurred in an application involving default arguments.
我没有找到与yabe工作示例的区别......
你为什么我有这个错误?
答案 0 :(得分:3)
根据评论中的建议,添加
import play.db.anorm.SqlParser._