A former middle school lunch lady accused of repeatedly molesting a 15-year-old boy pleaded guilty today to four counts of rape of a child as jury selection was getting underway for her trial, a spokesman for Norfolk District Attorney Michael W. Morrissey said.

Janelle Foley, 38, was sentenced by Norfolk Superior Court Judge Thomas A. Connors to 2 1/2 to 4 1/2 years in prison on the first count, to be followed by five years’ probation for the remaining three counts.

During that time, Foley, a mother, will be monitored by GPS, must register as a sex offender and will be forbidden to have unsupervised contact with children under age 18, except for her own children.

Foley has been out on GPS and $5,000 bail since her indictment in 2014, which alleged she sexually abused the teen during holiday parties at his family’s home.

Morrissey spokesman David Traub said the district attorney agreed to Foley’s sentence.