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.
Joined: Jul 04, 2003
Kyle, Thanks for your help. I don't know how I missed these lines in ejbLoad().
The problem is this - JBoss server requires to be re-started every time for the correct values to be fetched by the ejbFindByName() method.