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.
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
:https://github.com/icatproject/icat.server/blob/f86b255fc7ab43cdcb55876b57966c22ff39b08a/src/main/java/org/icatproject/core/entity/InvestigationParameter.java#L43
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.