Methylene iodide and two equivalents of ethyl acetoacetate react in the presence of sodium methoxide to form the diethyl ester of 2,4-diacetyl pentane. This precursor is treated with base to induce cyclization. Finally, heat is applied to generate Hagemann's ester.