jpa converter only applied to high value of cb.between

Description

In this example I would expect both NINE and ELEVEN to be converted with the DollarsToCentsConverter.
Only ELEVEN is.
This problem doesn't ocur when using jpql.
Also doesn't occur when using cb.and(cb.ge(...), cb.le(...)).

@Test public void testCriteriaBetween9And11Is10() { System.out.println("*** testCriteriaBetween9And11Is10 ***"); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Amount> cq = cb.createQuery(Amount.class); Root<Amount> root = cq.from(Amount.class); List<Amount> resultListBetweenLowAndHighWithCB = em.createQuery(cq .select(root) .where(cb.between(root.get(Amount_.dollars), NINE, ELEVEN))) .getResultList(); assertThat(resultListBetweenLowAndHighWithCB.size(), is(1)); }

Attachments

1
  • 22 Aug 2014, 05:06 PM

Activity

Show:

Steve Ebersole October 28, 2015 at 3:26 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Steve Ebersole October 27, 2015 at 7:15 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Etienne Miret August 24, 2014 at 9:08 AM

Pull request that fixes this issue (and adds some tests).

For the record, JPQL or HQL didn’t work either if literals were being used rather than parameters, and the criteria query was translating its parameters into literal when creating the HQL (which may not be a good idea by the way). My patch fixes the HQL queries with a between construction and literals, which automatically solved the issue with the criteria API.

Kristof Neirynck August 22, 2014 at 5:06 PM

testcase also available here: https://github.com/Crydust/HHH-9356

Kristof Neirynck August 22, 2014 at 5:06 PM

testcase

Fixed

Details

Assignee

Reporter

Labels

Fix versions

Affects versions

Priority

Created August 22, 2014 at 4:59 PM
Updated January 13, 2016 at 6:27 PM
Resolved January 10, 2016 at 3:15 AM

Flag notifications