diff --git a/invenio_db/uow.py b/invenio_db/uow.py index 73ec442..8ee73bd 100644 --- a/invenio_db/uow.py +++ b/invenio_db/uow.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2024 CERN. +# Copyright (C) 2024 Graz University of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -167,6 +168,7 @@ def __init__(self, session=None): def __enter__(self): """Entering the context.""" + self.session.begin_nested() return self def __exit__(self, exc_type, exc_value, traceback): @@ -199,7 +201,7 @@ def commit(self): def rollback(self, exception=None): """Rollback the database session.""" - self.session.rollback() + self.session._transaction.rollback(_to_root=False) # Run exception operations if exception: