how to use new scala 2.8.0 nested annotations

后端 未结 1 915
悲&欢浪女
悲&欢浪女 2021-02-15 10:06

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.

@N         


        
1条回答
  •  被撕碎了的回忆
    2021-02-15 10:50

    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'")
    ))
    

    0 讨论(0)
提交回复
热议问题