It is generally a good idea to write metadata only into JPG files. If you do want to save metadata for every RAW file - enabling use of sidecar .xmp files is a universally safe method. Writing directly into RAW files is safe for .DNG files, but results may vary with other RAW file formats. Use at your own risk.
Transcribed from Mohamed Malik's blog, 1 March 2011