The dealer is correct, you can just change the batteries with no issues - it won't forget its programming.
I change the ones in my '98 XJ every couple of years with no issues.
In our '97 ZJ, we used to have trouble with some dirty contacts in the key fob which meant that we had to take the batteries out to clean several times per week, again with no problems.
Once the battery in our ZJ's fob died whilst we were out for the day. We walked to a supermarket to buy some new ones and everything was fine. We now keep spare batteries in the coin holders in the arm rest!
Edit: If you have trouble after replacing the batteries, try pressing the Lock button first. I think the Lock button must re-sync it or something, as the Unlock button usually won't work without pressing Lock beforehand after a battery change.
My girlfriend has run back into the house many times complaining that she can't get into her ZJ!