jpa 如何关联查询

zrz55661 发布于 2014/04/27 00:49
阅读 957
收藏 0

User

@Entity
@Table(name = "t_user", catalog = "jpa")
public class User implements java.io.Serializable {

// Fields

private Integer id;
private Dept dept;
private String name;

 
Dept


/**
* Dept entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "t_dept", catalog = "jpa")
public class Dept implements java.io.Serializable {

// Fields

private Integer id;
private String name;
private Set<User> users = new HashSet<User>(0);

 

select model from User model where model.dept.name = :propertyValue

如果使用CriteriaQuery改写应该怎么写?

加载中
返回顶部
顶部