|
Hibernate example source code file (Parent.java)
The Hibernate Parent.java source code//$Id$ package org.hibernate.test.annotations.inheritance.joined; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; /** * @author Emmanuel Bernard */ @Entity @Table(name = "Parent") public class Parent { private Integer id; private Set propertyAssets = new HashSet(); private Set financialAssets = new HashSet(); @Id @GeneratedValue public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "parent", targetEntity = PropertyAsset.class) public Set getPropertyAssets() { return this.propertyAssets; } public void setPropertyAssets(Set propertyAssets) { this.propertyAssets = propertyAssets; } @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "parent", targetEntity = FinancialAsset.class) public Set getFinancialAssets() { return this.financialAssets; } public void setFinancialAssets(Set financialAssets) { this.financialAssets = financialAssets; } } Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Parent.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.