This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes campare two javabeans Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "campare two javabeans" Watch "campare two javabeans" New topic
Author

campare two javabeans

anvi kon
Ranch Hand

Joined: Jan 08, 2010
Posts: 133
Hi,

Can someone help me in camparing two javabeans values?

I have used the from org.apache.commons.beanutils.BeanComparator;

I have tried to use the compare function but it is throwing classcast exception?


I have two java beans employeeBean and deptBean.

Can I use like bleow to compare the values of the bean?



thanks.


Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
You are using the no argument constructor of BeanComparator. Have you executed the setProperty() method? If you do not then BeanComparator will try to compare the two objects the "usual way". Alternatively, you can use one of the other two BeanComparator constructors.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: campare two javabeans
 
Similar Threads
html Checkbox value not getting
Sorting objects based on potentially null property values
using jakarta nullcomparator
How to transfer Objects from JSP to a Servlet?
Compare Two Text Files