This melody was written by George Frideric Handel (1685-1759) for his oratorio Joshua. In that, it's a chorus, See the Conquering Hero Comes. Later, Edmond Budry (1854-1932) wrote a hymn to it which is popular for weddings and funerals.