He was elected on May 17 , 2005 , defeating the mayor in office , James Hahn . He was then re-elected for a second term in 2009 . He was elected on May 17 , 2005 , defeating incumbent mayor James Hahn , and then re-elected for a second term in 2009 .