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

It's not possible to update investigations with parameters through the REST API #276

Open
WHTaylor opened this issue Feb 21, 2022 · 0 comments

Comments

@WHTaylor
Copy link

Hi, I was getting some errors last week whilst trying to update some investigations on our ICAT instance via the REST API. I eventually worked out that it was only failing on investigations which had parameters, and found the cause in InvestigationParameter::preparePersist:

After this, the entity manager tries to merge the entity back into the database with a call to flush() which fails because the primary key can't be null (EntityBeanManager:2102). It works when creating new investigations because persist() generates a new ID for anything without one. It also works through the SOAP API, because EntityBeanManager::update doesn't use preparePersist.

Would it be possible to remove the problem line entirely? InvestigationParameter is the only entity which does this, and it doesn't seem like useful behaviour, but it's been around since 2014 so possibly something depends on it.

WHTaylor added a commit to WHTaylor/icat.server that referenced this issue Jul 26, 2024
This fixes icatproject#276, making it possible to update InvestigationParameters and Investigations with parameters via the REST API. Removing the id was causing persist to try and create a new entity with the same fields immediately after the call to preparePersist, which fails because of the (investigation, type) uniqueness constraint on InvestigationParameter.
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

1 participant