我有以下类别(实体)
@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
}
Now i want to get all arrival status of all magazine , whether magazine has in or not
使用标准
以下是法典
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);
但是,我并没有看到所有杂志的收发日期和日期都是无效的。 RLI JOIN没有得到支持。 什么错误?