2011-10-19 54 views

回答

1
CriteriaBuilder cb = em.getCriteriaBuilder(); 
CriteriaQuery<Cartera> query = cb.createQuery(Cartera.class); 
Root<Cartera> cartera = query.from(Cartera.class); 
Root<Cliente> cliente = query.from(Cliente.class); 
query.select(cartera); 
query.where(cb.equal(cartera.get(Cartera_.aseId), theAseId), 
      cb.equal(cliente.get(Cliente_.aseId), theAseId)); 

應該做的伎倆。雖然沒有測試過。

+0

是的,它的工作對我來說謝謝 – ArokLair

0

JB Nizet的答案後,你還必須有

TypedQuery<Cartera> tq = em.createQuery(query); 
tq.setFirstResult(offset); // how many records to skip 
tq.setMaxResults(pageSize); // don't want to fetch a million records 
List<Cartera> list = tq.getResultList();