I have a following method:
public Book findBookByTitleAndVersion(String title, Float version) {
TypedQuery<Book>query = em.createQuery("SELECT b FROM Book b WHERE b.title = ?1 AND b.version = ?2" ,Book.class);
query.setParameter(1, title);
query.setParameter(2, version);
return query.getSingleResult();
}
I'm using MySQL and I have some records that should be returned. I store 'version' as float type (1.22 in my case). This query returns:
javax.persistence.NoResultException: No entity found for query
Float has something to do here, as query by title works fine.