Refactor hibernate + add of missing files