This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

campare two javabeans  RSS feed

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!