How to use @PersistentCapable annotation in Scala 2.8
I'm switching from Scala 2.7.7 to Scala 2.8.0RC3 and now a few of my classes don't compile anymore. The problem is in the @PersistentCapable annotation:
import javax.jdo.annotations._
import java.util.Date
@PersistenceCapable{identityType=IdentityType.APPLICATION}
class Counter(dt: Date, cName: String, vl: int) {
<.. snip ..>
}
This code results in the following compilation errors:
[ERROR] /Users/gero/prive/kiva/kivanotify-gae/src/main/scala/net/vermaas/kivanotify/model/LoanProcessed.scala:7: error: expected start of definition
[INFO] @PersistenceCapable{val identityType = IdentityType.APPLICATION}
I already tried a couple of variations, did some Googling but without luck. Any ideas on how I can use the @PersistentCapable annotation with Scala 开发者_运维百科2.8.0 RC3?
Thanks, Gero
The syntax has changed in 2.8, you should use named arguments:
@Table(name = "projects")
class Project(name: String) {
@GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Int = _
}
http://scala-programming-language.1934581.n4.nabble.com/JPA-annotations-fails-when-using-2-8-beta-also-rc2-td1935831.html
Try @PersistenceCapable(identityType = IdentityType.APPLICATION)
Note ()
, rather than {}
Did not find a solution that enables me to use the annotations again, but of course you can switch to putting the JDO meta data in an XML file... and that's what I did. Would rather use the annotations, but at least I can continue now.
Gero
精彩评论