Skip to content
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

Updating an entity that violates a unique constraint gives no indication the violation occurred #355

Closed
kgreen24 opened this issue Aug 26, 2016 · 4 comments

Comments

@kgreen24
Copy link

I have an entity that has a unique constraint on a name property:

Map(x => x.Name).Unique();

My backing database is SQL Server 2014.

When I try to add a new record with a name that already exists in the db, I get a nice exception that I can catch and deal with. However, if I update an entity with the name of an already existing entity and try to persist it, there is no exception thrown anywhere or otherwise any indication given that the constraint was violated. Code execution continues as normal, and the row in the db is just not updated.

There should be a way to catch and deal with constraint violation errors on update as there is with add.

@chester89
Copy link
Collaborator

@kgreen24 sorry I haven't seen that issue sooner. What does NHibernate people say about this? Something tells me it's not a fluent problem

@hazzik
Copy link
Member

hazzik commented Sep 19, 2020

FluentNHibernate is a mapping generator tool. Not the ORM itself.

Please post on the nhusers group with requested details.

@hazzik hazzik closed this as completed Sep 19, 2020
@MichaelRodrigueess0s1
Copy link

I know the fluent Nhibernate is a mapping generator tool. Not the NORM itself. but the problem still occurring just when using the fluent Nhibernate. and your response does not help in anything

@oskarb
Copy link
Member

oskarb commented Jan 5, 2022 via email

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

No branches or pull requests

5 participants