I have a question. I want to compare two java beans of the same type. My problem is this, my bean is having
almost 100 fields, so if i start comparing the properties one by one, it will be hell lot tedious. Like we use BeanUtils.copy()
to copy the properties from one bean to the other, can we compare two beans somewhat?
I don't want to compare the properties one by one. Secondly my java bean is a simple bean, it is not implementing any
comparator interface even.
Any help or pointer in this regard will be highly helpful.
--Lost in preparation of SCJP and SCWCD--
"Start writing a new chapter, for if you live by the book you'll never make history." (Ben Sobel)
no need to check each field... just like you have a composite primary key in databases, try identifying a few number of fields which will identify your object as unique... and companre those fields in the equals() method.
Joined: Apr 08, 2007
Actually i am writing a JUnittest case and for this purpose, i need to compare the full result with the desire bean