Justin Timberlake is heading back to the big screen, this time opposite his former girlfriend, Cameron Diaz.

The 29-year-old star has been cast as the male lead in Bad Teacher, American Superstar has learned.

Molly Shannon and Eric Stonestreet also are joining the film's cast.

The movie tells the story of a foul-mouthed, gold-digging seventh-grade teacher (Cameron) who gets dumped and decides to go after a colleague's boyfriend (Timberlake).

Others who previously signed on for the Columbia Pictures comedy include Jason Segel, John Michael Higgins and Lucy Punch, who plays the woman dating Timberlake's character.

Shooting on Bad Teacher will begin later this month in Los Angeles.