[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-3820) Criterion should implement equals and hashCode

Dagguh (JIRA) noreply at atlassian.com
Tue Jan 10 09:14:10 EST 2012


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45065#comment-45065 ] 

Dagguh edited comment on HHH-3820 at 1/10/12 8:13 AM:
------------------------------------------------------

The following test case fails:

{code}
@Test
public void testEqualCriteria() throws Exception {
	// given
	String propertyName = "a";
	String lo = "b";
	String hi = "c";

	// when
	Criterion expectedCriterion = Restrictions.between(propertyName, hi, lo);
	Criterion actualCriterion = Restrictions.between(propertyName, hi, lo);

	// then
	assertEquals(expectedCriterion, actualCriterion);
}
{code}

      was (Author: dagguh):
    The following test case fails:

@Test
public void testEqualCriteria() throws Exception {
	// given
	String propertyName = "a";
	String lo = "b";
	String hi = "c";

	// when
	Criterion expectedCriterion = Restrictions.between(propertyName, hi, lo);
	Criterion actualCriterion = Restrictions.between(propertyName, hi, lo);

	// then
	assertEquals(expectedCriterion, actualCriterion);
}
  
> Criterion should implement equals and hashCode
> ----------------------------------------------
>
>                 Key: HHH-3820
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3820
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.6
>            Reporter: Craig
>
> .equals() doesn't work as expected for Criterion and its subclasses. For example:
> assertEquals(Restrictions.isEmpty("parents"),Restrictions.isEmpty("parents"));
> fails, when clearly, it should work.

--
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