1 package org.hibernate.test.annotations.entity; 3 4 import java.util.Date ; 5 import javax.persistence.Entity; 6 import javax.persistence.Id; 7 import javax.persistence.GeneratorType; 8 import javax.persistence.Column; 9 10 import org.hibernate.annotations.Type; 11 import org.hibernate.annotations.Columns; 12 13 16 @Entity 17 public class Ransom { 18 private Integer id; 19 private String kidnapperName; 20 private MonetaryAmount amount; 21 private Date date; 22 23 @Id(generate=GeneratorType.AUTO) 24 public Integer getId() { 25 return id; 26 } 27 28 public void setId(Integer id) { 29 this.id = id; 30 } 31 32 public String getKidnapperName() { 33 return kidnapperName; 34 } 35 36 public void setKidnapperName(String kidnapperName) { 37 this.kidnapperName = kidnapperName; 38 } 39 40 @Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType") 41 @Columns(columns = { 42 @Column(name="r_amount"), 43 @Column(name="r_currency") 44 }) 45 public MonetaryAmount getAmount() { 46 return amount; 47 } 48 49 public void setAmount(MonetaryAmount amount) { 50 this.amount = amount; 51 } 52 53 public Date getDate() { 54 return date; 55 } 56 57 public void setDate(Date date) { 58 this.date = date; 59 } 60 } 61 | Popular Tags |