# Broken optimistic lock

**URL:** <https://forum.inductiveautomation.com/t/broken-optimistic-lock/11025>\
**Category:** 3rd Party Modules\
**Created:** [January 11, 2016, 1:31pm UTC](https://forum.inductiveautomation.com/t/broken-optimistic-lock/11025 "2016-01-11T13:31:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benoit](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@benoit](https://forum.inductiveautomation.com/u/benoit)\
**Post date:** [January 11, 2016, 1:31pm UTC](https://forum.inductiveautomation.com/t/broken-optimistic-lock/11025/1 "2016-01-11T13:31:29Z")

</div>

Hi !

While developing a gateway module I have this problem :  
I am unable to modify the “first” item of the device properties. When I try a get a “broken optimistic lock error”.  
I can modify other properties, but this one I cannot, even if the device in not enabled.

The properties is defined as  
public static final StringField USER = new StringField (META, “User”, SFieldFlags.SMANDATORY); /\*\*\< User name META data. \*/ in the device setting class.

It is not the exactly the first property as the first property is DEVICE\_SETTINGS\_ID a long int that is the primary key, but that does not belong to any category, So USER is the first property of the only category.

Thanks for your help !

---

<div class="post-metadata">

**Author:** ![benoit](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@benoit](https://forum.inductiveautomation.com/u/benoit)\
**Post date:** [January 13, 2016, 9:38am UTC](https://forum.inductiveautomation.com/t/broken-optimistic-lock/11025/2 "2016-01-13T09:38:38Z")

</div>

It seems the problem is due to the database field name : “User”.  
Once it has been changed to UserName it works properly.

public static final StringField USER = new StringField (META, “[color=#FF0000]UserName[/color]”, SFieldFlags.SMANDATORY); /\*\*\< User name META data. \*/ in the device setting class.

For my point of view it is solved, but i’m still curious about the reason why a ‘User’ field lead to such problem.
