Rewrite the system using the hibernate classes