generate id when invoking the method of session.saveOrUpdate()