|
Hibernate example source code file (B2.java)
The Hibernate B2.java source code//$Id$ package org.hibernate.ejb.test.emops.cascade; 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.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; @Entity public class B2 { @Id @GeneratedValue( strategy = GenerationType.AUTO ) private int id; @ManyToOne( fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST} ) @JoinColumn( name = "aId" ) private A a; @OneToMany( fetch = FetchType.LAZY, mappedBy = "b2", cascade = {CascadeType.PERSIST} ) private Set<C2> c2List; public A getA() { return a; } public void setA(A a) { this.a = a; } public Set<C2> getC2List() { if ( c2List == null ) c2List = new HashSet<C2>(); return c2List; } public void setC2List(Set<C2> list) { c2List = list; } public int getId() { return id; } public void setId(int id) { this.id = id; } } Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate B2.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.