implemented hibernate code.