[hibernate-issues] [Hibernate-JIRA] Created: (JPA-27) Problem whith criteria search
Samuel Rettore (JIRA)
noreply at atlassian.com
Thu Jan 12 12:18:13 EST 2012
Problem whith criteria search
-----------------------------
Key: JPA-27
URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-27
Project: Java Persistence API
Issue Type: Bug
Affects Versions: 1.0.0
Reporter: Samuel Rettore
Two criteria to a search and no one uses criteria that works with JPQL criteria does not work seems to be the date field where the comparison does not work.
Criteria- fail
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<SrhaplicacaoSaldo> criteriaQuery = builder.createQuery(SrhaplicacaoSaldo.class);
Root<SrhaplicacaoSaldo> root = criteriaQuery.from(SrhaplicacaoSaldo.class);
criteriaQuery.select(root);
criteriaQuery.where(builder.equal(root.get(SrhaplicacaoSaldo_.idaplicacao).
get(Srhaplicacao_.idaplicacao), idaplicacao),
builder.equal(root.get(SrhaplicacaoSaldo_.dataSaldo), dataSaldo));
criteriaQuery.orderBy(builder.desc(root.get(SrhaplicacaoSaldo_.dataSaldo)),
builder.desc(root.get(SrhaplicacaoSaldo_.idaplicacaosaldo)));
return em.createQuery(criteriaQuery).
setMaxResults(1).
getSingleResult();
JPQ - OK
return (SrhaplicacaoSaldo) em.createQuery("Select a from SrhaplicacaoSaldo a where "
+ "a.idaplicacao.idaplicacao=:idaplicacao and a.dataSaldo=:dtsaldo order by a.dataSaldo,a.idaplicacaosaldo ").
setParameter("idaplicacao", idaplicacao).
setParameter("dtsaldo", dataSaldo).
setMaxResults(1).
getSingleResult();
Tanks.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list