optimistic-concurrency

Having trouble doing an Update with a Linq to Sql object

Hi folks, i've got a simple linq to sql object. I grab it from the database and change a field then save. No rows have been updated. :( When I check the full Sql code that is sent over the wire, I notice that it does an update to the row, not via the primary key but on all the fields via the where clause. Is this normal? I would have ...

NHibernate not throwing StaleObjectStateException when <Version> used and data changed in database

I have an entity mapped in NHibernate with optimistic concurrency control using a SQL timestamp column as the version number. The mapping is like the following: <class name="Entity" optimistic-lock="version" discriminator-value="0"> <id name="id"> <generator class="native" /> </id> <version name="Version" column="Ver...

Hibernate - StaleObjectStateException in query possible?

Is it possible to get a StaleObjectStateException with Hibernate when you do the same query twice inside one tx if the result data of that query gets changed by a concurrent update inside a different session between the first and the second query? I am using optimistic concurrency control on all entities in this scenario. So it looks l...

Problem with inserting using linq-to-entities

Hi I'm having trouble solving this error. Any help on the problem would be much appreciated, thanks! Error message: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries. Whenever I try to add a Lapt...

Concurrency Violation in NHibernate( c#) example

For quite some time , I was reading about the optimistic concurrency in NHibernate. If what i understood was correct then the below sample should hold good. Consider two transactions T1 and T2. When T1 and T2 are done simultaneously , the state(DB entries) gets updated with the values of the most latest update.(T1 or T2). Though it ...

Problems with Optimistic Concurrency through an ObjectDataSource and a GridView

Hi I'm having a problem in an ASP .NET 2.0 Application. I have a GridView displaying data from an ObjectDataSource (connected to a BLL class which connects to a TabledAdapter (Typed Dataset using optimistic concurrency). The select (displaying the data) works just fine, however, when I update a row the GridView does pass the old value...

How should I handle this Optimistic Concurrency error in this Entity Framework code, I have?

Hi folks, I have the following pseduo code in some Repository Pattern project that uses EF4. public void Delete(int someId) { // 1. Load the entity for that Id. If there is none, then null. // 2. If entity != null, then DeleteObject(..); } Pretty simple but I'm getting a run-time error:- ConcurrencyException: Store, Update...

versioning fails for onetomany collection holder

given parent entity @Entity public class Expenditure implements Serializable { ... @OneToMany(mappedBy = "expenditure", cascade = CascadeType.ALL, orphanRemoval = true) @OrderBy() private List<ExpenditurePeriod> periods = new ArrayList<ExpenditurePeriod>(); @Version private Integer version = 0; ... } and child one...

How to figure the read/write ratio in Sql Server?

How can I query the read/write ratio in Sql Server 2005? Are there any caveats I should be aware of? Perhaps it can be found in a DMV query, a standard report, a custom report (i.e the Performance Dashboard), or examining a Sql Profiler trace. I'm not sure exactly. Why do I care? I'm taking time to improve the performance of my web a...

Entity Framework 4: Inheritance and Optimistic Concurrency

Hi guys, I'm using AdventureWorks 2008 R2 database and added the BusinessEntity and Person tables to my EDMX. Then I changed the model in which the Person table inherits from the BusinessEntity table. As you may know these two tables have ModifiedDate and rowguid columns so the Person class should not have these properties because it inh...

DataContext Conflicts with no Member conflicts

I am getting a ChangeConflictException when I try to SubmitChanges using my DataContext. The submit is attempting to do 8 updates with each update being only a single field in the record. When I catch the exception, I have looked at the .ChangeConflicts and there are 8 of them, but here's the weird thing, the .MemberConflicts of each c...

Concurrency in django admin change view

My model: class Order(models.Model): property_a = models.CharField() property_b = models.CharField() property_c = models.CharField() Many users will access a given record in a short time frame via admin change page, so I am having concurrency issues: User 1 and 2 open the change page at the same time. Assume all values a...

Are nullable foreign keys allowed in Entity Framework 4?

I have a problem updating a foreign key in an Entity Framework entity. I am using self tracking entities and have an entity with some relations where the foreign key is also present as a property (one of the new features of EF4). The key (an integer) is marked as Nullable and Concurrency Mode fixed. Specifically I have an Alarm entity w...

What's a good end user message for optimistic concurrency failures.

I'm trying to come up with some good words to explain an optimistic concurrency exception to a user. It turns out it's a lot harder that I thought it would be. the best I have so far is: Someone else has already modified the record you were working on. Their new values are shown below. Please remake the changes you made. This...

How do I get Linq-to-SQL to ignore columns that are modified by INSERT triggers?

There's a column on one of my tables that's being updated by various INSERT/DELETE triggers in my database - the triggers perform some calculation based on the contents of linked tables and store the result in a column on the base table for easier querying, etc. Linq-to-SQL is throwing a ChangeConflictException when I try to update thes...

WCF RIA Services and Optimistic Concurrency

I have a WCF RIA service app that in one of its services Insert method I should assign an incremental identification code to a property of its entity from the previously added record. I use SQL server and Entity framework in DAL. How can I avoid optimistic concurrency in such situations and assign the code without the knowledge of the ...

How to solve Optimistic Concurrency Updates in c# .NET N-tier applications?

Hy everyone. In c# .net VS 2008 I'm developing an N-tier CRM framework solution and when it's done I want to share it. The architecture is based on: Data Access Layer, Entity Framework, Bussines Logic Layer, WCF and finally the presentation layer (win forms). Somewhere I had read, that more than 2 tier layers are problematic, beacus...