 He graduated from Harvard University in 1782, studied law, was admitted to the bar in 1786 and commenced practice in Mendon, Massachusetts.He was town treasurer in 1794 and 1795, and was elected one of the first school commissioners in 1796.Hastings was elected as a Federalist to the Seventh Congress to fill the vacancy caused by the resignation of Levi Lincoln.