You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Benjamin Klatt <be...@bar54.de> on 2009/09/15 09:29:05 UTC

Ibator: generate equals and hashcode in Example classes

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

 


AW: Ibator: generate equals and hashcode in Example classes

Posted by Iwao AVE! <ha...@gmail.com>.
Benjamin,

Thank you for adding the link.
I was just unsure about its usefulness :)

// Iwao

on 09/09/15 17:53 Benjamin Klatt said the following:
> Hi Iwao,
>
> thanks a lot!
>
> I add a link to your code in the wiki:
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/3rd+Party+Ibat
> or+Plugins
> Hope this is ok for you.
>
> Thanks
> Benjamin
>
>
> -----Ursprüngliche Nachricht-----
> Von: Iwao AVE! [mailto:harawata@gmail.com]
> Gesendet: Dienstag, 15. September 2009 10:08
> An: user-java@ibatis.apache.org
> Betreff: Re: Ibator: generate equals and hashcode in Example classes
>
> 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.htm
> l
>>
>> 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


AW: Ibator: generate equals and hashcode in Example classes

Posted by Benjamin Klatt <be...@bar54.de>.
Hi Iwao,

thanks a lot!

I add a link to your code in the wiki:
http://opensource.atlassian.com/confluence/oss/display/IBATIS/3rd+Party+Ibat
or+Plugins
Hope this is ok for you.

Thanks
Benjamin


-----Ursprüngliche Nachricht-----
Von: Iwao AVE! [mailto:harawata@gmail.com] 
Gesendet: Dienstag, 15. September 2009 10:08
An: user-java@ibatis.apache.org
Betreff: Re: Ibator: generate equals and hashcode in Example classes

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.htm
l
> 
> 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


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


Re: Ibator: generate equals and hashcode in Example classes

Posted by Iwao AVE! <ha...@gmail.com>.
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


Re: Ibator: generate equals and hashcode in Example classes

Posted by Iwao AVE! <ha...@gmail.com>.
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