1 package org.hibernate.test.annotations.inheritance.singletable; 3 4 import javax.persistence.Entity; 5 import javax.persistence.Id; 6 import javax.persistence.GeneratorType; 7 import javax.persistence.Column; 8 9 import org.hibernate.annotations.DiscriminatorFormula; 10 11 14 @Entity 15 @DiscriminatorFormula("case when zik_type is null then 0 else zik_type end") 16 public abstract class Music { 17 private Integer id; 18 private int avgBeat; 19 private Integer type; 20 21 @Column(name="zik_type") 22 public Integer getType() { 23 return type; 24 } 25 26 public void setType(Integer type) { 27 this.type = type; 28 } 29 30 @Id(generate=GeneratorType.AUTO) 31 public Integer getId() { 32 return id; 33 } 34 35 public void setId(Integer id) { 36 this.id = id; 37 } 38 39 public int getAvgBeat() { 40 return avgBeat; 41 } 42 43 public void setAvgBeat(int avgBeat) { 44 this.avgBeat = avgBeat; 45 } 46 } 47 | Popular Tags |