Hi, I use JBoss and MySql. I am trying to run an entity bean (BMP). I have the following classes: ProdHome, ProdRem, ProdPK (Primary Key), ProdBean and ProdClient. Everything works fine, but the "findByName(String name)" always returns the last inserted row details.
The records get inserted in the DB. But it keeps printing the "Sams Learn Java" details for the findByName() method. Please help me figure out where my mistake lies.
Discipline, Dedication and Determination define Destiny.
In your ejbLoad, where are you getting the prodID instance variable value from? Normally in a BMP wha happens is you go to the EntityContext to get the primary key object, and then use THAT value for the key value of your WHERE statement. My guess is since you're not doing that that prodID gets set once somewhere in your EJB class, and you keep using that same value.
I can't be certain because I don't see where you've set the prodID instance variable in your class.
Also -- you're eating all possible exceptions in your ejbLoad() method -- that will make it hard to debug problems -- print out the exception values instead of just dropping them.