modifying code to support hibernate