openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zhanming Qi <openglo...@gmail.com>
Subject Re: openjpa-2.0 how join fetch work?
Date Thu, 03 Jun 2010 11:19:10 GMT

Hi,
Here is my POJOs.

Corporation is:

@Entity
@Table(name = "CORPORATION")
public class Corporation implements Serializable{

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID", nullable = false)
	private int id;
	
	@Column(name = "CORPORATION_NAME")
	private String name;

	@OneToMany(mappedBy = "corporation", fetch = FetchType.LAZY)
	private Set<Division> divisions;
	
	@Version
	private int version;
	
	public Corporation() {
		
	}

getter and setter
}

Division is:

@Entity
@Table(name = "DIVISION")
public class Division implements Serializable{

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID", nullable = false)
	private long id;
	
	private String name;
	
	private long mumber;
	
	@Embedded
	private Address address;
	
	@ManyToOne
	@JoinColumn(name = "CORPORATION_ID")
	private Corporation corporation;
	
	@OneToMany(mappedBy = "division")
	private Set<Department> departments;
	
	@Version
	private int version;
	
	public Division() {
	}
getter and setter
}

Thanks.
Zhanming
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-2-0-how-join-fetch-work-tp5121731p5134729.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message