|
Hibernate example source code file (Hardware.java)
The Hibernate Hardware.java source codepackage org.hibernate.test.annotations.onetoone.hhh4851;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "DeviceType", length = 1)
@DiscriminatorValue(value = "C")
public class Hardware extends BaseEntity {
private Hardware parent = null;
protected Hardware() {
}
public Hardware(Hardware parent) {
this.parent = parent;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_id")
public Hardware getParent() {
return this.parent;
}
public void setParent(Hardware parent) {
this.parent = parent;
}
}
Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Hardware.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.