ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Iwao AVE!" <haraw...@gmail.com>
Subject Re: Ibator: generate equals and hashcode in Example classes
Date Tue, 15 Sep 2009 08:07:45 GMT
There is one thing you should know about the generated methods:
The order of criterion matters.

For example, the following two examples are the same from SQL
perspective, but example1.equals(example2) returns false.

example1.createCriteria()
  .andPropAEqualTo(condition1)
  .andPropBEqualTo(condition2);

example2.createCriteria()
  .andPropBEqualTo(condition2)
  .andPropAEqualTo(condition1);

You may be able to change the behavior, but it would be acceptable
for unit testing.

// Iwao


on 09/09/15 16:39 Iwao AVE! said the following:
> Hi Benjamin,
> 
> Here's mine.
> http://harawata.blogspot.com/2009/04/adds-equals-and-hashcode-to-ibators.html
> 
> Hope this helps,
> Iwao
> 
> on 09/09/15 16:29 Benjamin Klatt said the following:
>> Hi all,
>>
>> does someone know about an Ibator plugin to generate the equals and
>> hashcode methods for the Example classes?
>>
>> The existing EqualsHashCodePlugin does provide this functionality for
>> the data classes.
>>
>> Our intend is to have this methods also in the example classes for
>> better unit test capabilities in our application.
>>
>> It would be nice to know if there is something like that already in
>> place before we start a new one.
>>
>> Thanks
>>
>> Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message