Skip to content

Makes the session available to ISQLExceptionConverter. #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

alex-davidson
Copy link

Enables more advanced exception translations based on the persistence
context.

When using batching, details about the entity name and ID which caused a failure are unavailable to the exception converter. Given the name of a violated constraint, however, it is often possible to determine the offending entity by type if we have access to the persistence context. This commit makes the relevant information available to exception converters.

Enables more advanced exception translations based on the persistence
context.
@@ -35,7 +37,7 @@ public void BadGrammar()
catch (Exception sqle)
{
Assert.DoesNotThrow(
() => ADOExceptionHelper.Convert(sessions.SQLExceptionConverter, sqle, "could not get or update next value", null));
() => ADOExceptionHelper.Convert((ISessionImplementor)session, sessions.SQLExceptionConverter, sqle, "could not get or update next value", null));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be session.GetSessionImplementor()

@hazzik
Copy link
Member

hazzik commented Nov 18, 2014

Probably to 5.0.0 as it has a lot of public api changes

@hazzik hazzik added this to the 5.0.0 milestone Nov 18, 2014
@fredericDelaporte
Copy link
Member

I do not see any change in this PR for improving exception messages. The session is available to the sql exception converters, but none of them does anything of it. Correct me if I am wrong.

Then it is a lot of changes for no added feature, or only for enabling custom converter implementation to have the session.

And it looks like you were intending to infer the entities from the violated constraint name and some inspection of dirty entities in session I guess: it can only work if constraints are named according to entity names (or to table names at least).

@alex-davidson
Copy link
Author

Indeed. This PR is rather obsolete now and should probably be discarded. I've since learned that it was really the wrong approach anyway: these days we just try, rollback, infer failure reason from database state, maybe retry.

@fredericDelaporte
Copy link
Member

Ok, thanks for your answer, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants