我有以下類(實體)JPA2條件查詢JOIN
@Entity
public class Magazine {
private int id ;
private String magazine;
//getters and setters
}
// tracking the magazine arrival
@Entity
public class MagazineIn {
private int id;
private java.util.Date inDate;
private java.util.Date magdate;
@OneToOne
private Magazine mag ;
//getters and setters
}
現在,我想所有的雜誌都到達狀態,使用條件查詢
雜誌是否有或沒有以下是代碼
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Object[]> cq = cb.createQuery(Object[].class);
Root<MagazineIn> magIn = cq.from(MagazineIn.class);
Join<Magazine,MagazineIn> mag = magIn.join("mag" , JoinType.LEFT);
cq.multiselect(mag.get("magazine") , magIn.get("magdate") ,
magIn.get("inDate"));
TypedQuery<Object[]> q = em.createQuery(cq);
但我沒有得到所有的mag不支持嗪與銦酸和magdate null.RIGHT JOIN上市。怎麼了?