Expand my Community achievements bar.

Conflict when updating a record

Avatar

Former Community Member

Hello. I'm having a problem I just don't understand. I am using the SQLAssembler to save to an Oracle database.

My Flex GUI displays information about dependents in a datagrid. I populate the datagrid with an arraycollection that is populated by using a fill method. If I want to add a new dependent in the datagrid, I enter new information into a form and click a create button. My create button adds the dependent to the arraycollection. When I add this item to my arraycollection I also set it to a variable on my model called currentDependent:

model.dependentCollection.addItem(newDependent);

model.currentDependent = newDependent;

If I immediately go to edit this dependent, I get a conflict. Upon investigation I found that when I add the new dependentt to the arraycollection, its primary key gets populated with a number of xxx. When I go and edit the object store in model.currentDependent, somehow it gets an primary key of xxy. These two primary keys should be the same. They should be the same object. The id-query in the create-item of the SQLAssembler simply calls a sequencer for the next number for the primary key.

Any help would be greatly appreciated!

Thank you!

Brenda

2 Replies

Avatar

Former Community Member

For LCDS documentation is not very clear. Try to edit newDependent added before adding to the collection. If you want to edit later, then take it from the collection, after finnish, commit changes.

However it is not usual to add a object to collection and then edit it immediately. Not very logical in terms of how the application is built.

Avatar

Former Community Member

To fix this issue I used sequence.currval instead of sequence.nextval.