You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
WHTaylor
added a commit
to WHTaylor/icat.server
that referenced
this issue
Jul 26, 2024
This fixesicatproject#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.
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
:icat.server/src/main/java/org/icatproject/core/entity/InvestigationParameter.java
Line 43 in f86b255
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 becausepersist()
generates a new ID for anything without one. It also works through the SOAP API, becauseEntityBeanManager::update
doesn't usepreparePersist
.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.The text was updated successfully, but these errors were encountered: