Your ex was most likely diagnosed with Helicobacter pylori infection of his stomach.
Actually, this bacterium is one of the most common infection world wide affecting approximately 50 percent of the world's population.
Still, it is little known about its mode of transmission.
Oral to oral route for transmission or through kissing, is one of the possible ways to get infected, since the bacterium can be find in saliva.
Stomach pain at the contact with food or pain after finishing the meal is suggestive for gastritis (stomach wall inflammation) or stomach ulcer.
Both conditions can be caused by this bacteria.
See your physician!