Skip to content

Instantly share code, notes, and snippets.

@ymnk
Created April 20, 2009 14:37
Show Gist options
  • Save ymnk/98561 to your computer and use it in GitHub Desktop.
Save ymnk/98561 to your computer and use it in GitHub Desktop.
package net.liftweb.example.model
import javax.persistence._
import com.google.appengine.api.datastore.Key
@Entity
class Author {
@Id
@GeneratedValue(){val strategy = GenerationType.IDENTITY}
var id : Key = _
@Column{val nullable = false}
var name : String = ""
@OneToMany{val mappedBy = "author", val targetEntity=classOf[Book]}
var books : java.util.List[Book] = _
}
package net.liftweb.example.model
import com.google.appengine.api.datastore.Key
import java.util.Date
import javax.persistence._
import org.hibernate.annotations.Type
@Entity
class Book {
@Id
@GeneratedValue(){val strategy = GenerationType.IDENTITY}
var id : Key = _
@Column{val nullable = false}
var title : String = ""
@Column{val nullable = true}
var published : Date = new Date()
@Column{val nullable = true}
var genre : String = "unknown"
@Column{val nullable = false}
@ManyToOne
var author : Author = _
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment