Question

In the yabe example, there is this query :

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

In my app, I have a very similar query :

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

I have this compile error :

The file /app/models.scala could not be compiled. Error raised is : not found: 
value flatten Error occurred in an application involving default arguments.

I don't find the difference with the yabe working example...

Do you why I have this error?

Was it helpful?

Solution

As suggested in comments, add

import play.db.anorm.SqlParser._
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top