A Long Beach man was sentenced to three years in county jail for harassing his ex-girlfriend, who had obtained a restraining order to protect herself and her two children, one of whom he fathered, the Long Beach city prosecutor’s office announced today.