adapting the entity and session for the changement on the database.