This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Default field annotation?

No replies
Roland RECKEL
Joined: 2010-05-19,
User offline. Last seen 42 years 45 weeks ago.
Hi all,
I have a little problem with scala 2.8.0 (I used 2.8.0.beta before)
I have the following Hibernate entity case class:
@Entitycase class Test(
  @Id  val id: Long = 0l) extends Serializable {  def this() = this(0l)}
I 2.8.0.beta this worked perfect, because the annotations are attached to the private field (so no need for getter/setter methods for Hibernate).Now with 2.8.0 Hibernate throws an AnnotationException saying; "No identifier specified for entity"and so I have to explicitly tell scala to annotate the field:
@Entitycase class Test(
  @(Id @field)  val id: Long = 0l) extends Serializable {  def this() = this(0l)}
Is this the expected behavior?The documentation http://www.scala-lang.org/sid/5 seems to say that by default the field should be annotated!
Thanks for replies/help
Roll

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland