For info, you can take the book sample jpa application and split out
the hibernate Id stuff as follows:

import common.JPAId
...

/**
 This class represents a book that we might want to read.
*/
@Entity
class Book extends Title with JPAId {


where JPAId was declared


trait JPAId {
  @Id
  @GeneratedValue(){val strategy = GenerationType.AUTO}
  var id : Long = _

}

But note, I had to put the JPAId in a separate package otherwise
hibernate tried to create an entity out of it and complained that it
could not do that for an abstract class. This is almost certainly due
to the fact that the orm.xml delcares

<package>com.foo.jpaweb.model</package>

which I assume tells hibernate implicitly try and JPA everything in
the package that has annotations. So to put the JPAId or whatever you
want to call it, I suggest you use a different package or different
way of telling hibernate what to do.

Derek - would it be worth putting the JPAId and a similar Version
trait into your ScalaJPA and including an example in the book?I think
it makes the domain (entity) objects more DRY - bit more like Grails/
GORM for example where everybody raves about the clean interface
presented by the Domain objects.
Tim




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to