WEB开发网
开发学院软件开发Java JPA2.0 Join联结查询 阅读

JPA2.0 Join联结查询

 2012-05-23 16:16:34 来源:WEB开发网   
核心提示:CriteriaBuilder cb = getEntityManager().getCriteriaBuilder(); CriteriaQuery<Photo> cq = cb.createQuery(Photo.class); Root<Photo> root_ = cq.from
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder(); 
  CriteriaQuery<Photo> cq = cb.createQuery(Photo.class); 
  Root<Photo> root_ = cq.from(Photo.class); 
  Join<Photo, ServiceItem> join = root_.join(Photo_.serviceItems, 
    JoinType.LEFT); 
  cq.select(root_);

JPA2.0 join联结查询

CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<Photo> cq = cb.createQuery(Photo.class);
Root<Photo> root_ = cq.from(Photo.class);
Join<Photo, ServiceItem> join = root_.join(Photo_.serviceItems,
		JoinType.LEFT);
cq.select(root_);

Tags:JPA Join 联结

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接