Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use new scala 2.8.0 nested annotations

looks like when scala 2.8.0 is out, we can use nested @annotations in our persistence layers. But how? Can anyone please transform this from java to scala? Thanks.

@NamedQueries({
    @NamedQuery(name = "findAll", query="select p from Person p"),
    @NamedQuery(name = "findTheOne",
          query="select p from Person p where p.name = 'Neo'")
})
like image 527
ryskajakub Avatar asked Jul 31 '10 01:07

ryskajakub


1 Answers

You have to wrap the elements in an Array() and write the nested annotations like a constructor call:

@NamedQueries(Array(
    new NamedQuery(name = "findAll", query="select p from Person p"),
    new NamedQuery(name = "findTheOne",
          query="select p from Person p where p.name = 'Neo'")
))
like image 62
Moritz Avatar answered Oct 12 '22 23:10

Moritz