Hartnett first came to prominence on the inter-county scene as a member of the Cork minor hurling teamin 2001. He made his debut when he came on as a substitute in a Munster quarter-final defeat of Waterford before later starting at midfield in the provincial decider. Tipperary were the winners by 1-12 to 1-6, however, Cork remained in the championship and reached the All-Ireland final via the back-door. Galway provided the opposition on that occasion, however, a 2-10 to 1-8 score line secured a victory for Cork and an All-Ireland medal for Hartnett. By 2005 Hartnett was a regular member of the Cork under-21 team. After back-to-back defeats by Tipperary in the provincial decider over the previous two years, Cork finally triumphed. A 4-9 to 0-13 victory gave Hartnett a Munster medal in that grade. Hartnett was also called up to the Cork intermediate hurling team. He won a Munster medal in this grade in 2003 following a 2-12 to 0-11 defeat of Waterford. He later lined out in the All-Ireland final with Kilkenny providing the opposition. In a classic game of hurling both sides were still level at the full-time whistle. There was little to separate the sides in a period of extra-time, however, Cork narrowly emerged victorious by 1-21 to 0-23. After being deemed ineligible for the team the following year, Hartnett was back with the intermediate side in 2005. A 2-17 to 2-11 defeat of Tipperary gave him a second Munster medal in that grade. In 2006 Hartnett collected a third Munster medal following a 2-18 to 2-13 defeat of Tipperary. The subsequent All-Ireland decider saw Cork face Kilkenny. A narrow 3-15 to 1-18 victory gave Hartnett a second All-Ireland medal. By this stage Hartnett had already joined the Cork senior team. He made his competitive debut when he came on as a substitute in a National Hurling League game against Waterford in 2005. He was also included on the Cork panel for the subsequent championship campaign and collected a set of Munster and All-Ireland medals as a non-playing substitute. In 2006 Hartnett was also an unused substitute as Cork retained the Munster crown but were later defeated by Kilkenny in the All-Ireland decider. Hartnett made his championship debut when he came on as a substitute in an ill-tempered Munster quarter-final defeat of Clare in 2007. Due to the suspensions of Donal Óg Cusack, Diarmuid O'Sullivan and Seán Óg Ó hAilpín following that game, Hartnett was handed his first championship start for the subsequent Munster semi-final. Cork lost to Waterford on that occasion but Hartnett became a regular member of the team before leaving the panel after the 2008 championship.