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

gh-295 flush when saving data class and data element in the subset operation #296

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

aaronforshaw
Copy link
Contributor

Fix a "StaleStateException" by flushing each save of target class and data element

@aaronforshaw
Copy link
Contributor Author

@olliefreeman I don't really understand why this fixes the problem (which was perhaps timing related), but it seems to

@olliefreeman
Copy link
Contributor

fixes #295

@olliefreeman olliefreeman linked an issue Mar 21, 2022 that may be closed by this pull request
@olliefreeman
Copy link
Contributor

given the error message it should only be the DE which needs to be flushed .. actual row count: 0; expected: 1; statement executed: update datamodel.data_type. Whats happening is the DT is being created/updated for the inclusion/exclusion of a DE, the DE and DC are being saved into the persistence context however the DT is not, its being "loosely" held by the DE. Flushing the DE causes the system to identify a change to the DT and therefore save it, however in the DMController when the save is called the DT change is not being detected (ORM being great here). This is why flushing on the DE works.

There shouldnt be an issue with this going forwards, however if anythign else arises the DMService "saveModelWithNewContentOnly" will need to be used rather than the default updateResource in the DMController, and flushes will need to be removed from the subset method.

@olliefreeman olliefreeman merged commit 56c5c74 into develop Mar 21, 2022
@olliefreeman olliefreeman deleted the feature/gh-295 branch March 21, 2022 11:57
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

Successfully merging this pull request may close these issues.

Internal Server Error when subsetting many data elements
2 participants