|
Hibernate example source code file (Music.java)
The Hibernate Music.java source code//$Id$ package org.hibernate.test.annotations.inheritance.singletable; import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; import javax.persistence.DiscriminatorType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; import org.hibernate.annotations.DiscriminatorFormula; /** * @author Emmanuel Bernard */ @Entity @DiscriminatorColumn(discriminatorType=DiscriminatorType.INTEGER) @DiscriminatorFormula("case when zik_type is null then 0 else zik_type end") @Table(uniqueConstraints = @UniqueConstraint(columnNames = {"avgBeat", "starred"} )) public abstract class Music { private Integer id; private int avgBeat; private Integer type; @Column(name = "zik_type") public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } @Id @GeneratedValue public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public int getAvgBeat() { return avgBeat; } public void setAvgBeat(int avgBeat) { this.avgBeat = avgBeat; } } Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Music.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.