The growth of thin films of the alkaline earth metals, Mg and Ba, on a transition metal, Pd, as well as on its hydride, was characterized using ultraviolet and x-ray photoemission spectroscopies. In addition, the valence-band region of BaH2 and of MgH2 has also been studied. Mg growing on Pd or on PdHx forms a 1-3-ML-thick interface alloy with increasing Mg content, which prevents further Mg-Pd mixing. Unlike Mg, a intermixes with metallic Pd over considerably larger depths, at 300 K. Introduction of hydro en prevents Ba-PdHx mixing. The Pd 4d band becomes filled upon deposition alkaline earth metals on both Pd and on PdHx. The overlayer-induced shift of the 4d level away from the Fermi edge becomes larger, while the full width at half maximum of the Pd 4d level becomes narrower with an increasing amount of alkaline metal deposited. Evaporating a thin Mg layer onto PdHx introduces features in the Pd 4d level emission, which we attribute to the formation of an interface Pd-Mg-H-x compound. In agreement with the commonly accepted view, the Ba and Mg hydrides are found to be insulators. The valence band of both compounds is characterized by a hydrogen-induced emission peaked around 4.3 eV (5.4 eV) for BaH2 (MgH2).