German factory orders rise 3.1% in June, beating expectations