Isolate Battery Supply from AC Adpater
By far the preferred method is simply using diodes, if you can afford the diode drop. This is guaranteed to work very reliably with minimal cost and complexity. Not much can go wrong.

If diodes are not an acceptable way of doing things, you will have to make some kind of active switching circuit. One way to do this, is to have P-channel MOSFETs on both power entries controlled by a small microcontroller or dedicated supervisor chip (search farnell/digikey/mouser for 'supervisors' or 'monitors' and you will see what these chips do), switching between the alternative power supplies as you require.