These two beetles were mating but they don’t seem to belong to the same species or even the same genus.
The male seems to belong to the genus Rhomborhina, whose metacoxas are in contact with each other (see the sixth and eighth picture, taken from another male beetle) , while the female’s are not (see the fifth and seventh picture).
And this mating seemed quite unpleasant, because the female beetle had been struggling to get away.