RestAPI gets execute but returns error

1
Hi All,   I am publishing rest API and it gets executed successfully but returns server error. Below is the attached screenshot of the error :   com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"current_activity":{"type":"End"},"name":"MobileAPI.PostSubmitrequest","type":"Microflow"}', all database changes executed by this action were rolled back     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.scala:110) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"current_activity":{"type":"End"},"name":"MobileAPI.PostSubmitrequest","type":"Microflow"}', all database changes executed by this action were rolled back     at com.mendix.util.classloading.Runner$.withContextClassLoader(Runner.scala:23) Caused by: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"current_activity":{"type":"End"},"name":"MobileAPI.PostSubmitrequest","type":"Microflow"}', all database changes executed by this action were rolled back     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.processErrorState(CoreActionHandlerImpl.scala:153) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: Autocommitted objects detected at end of transaction for system session for entities:   - UM6P.Partners: 1 instances   Can someone please guide me with it ?
asked
2 answers
2

Looks like your problem is related to autocommit. From the docs:

An autocommit is an automatic commit from the platform, which is done to keep the domain model in sync. If your application ends up having autocommitted objects, then you will have a modeling error. Since an association is also a member of an object, the association will be stored in the database as well. This means that if you create an order line inside an order and the order line is the parent of the association, when you commit the order line, the order will be autocommitted.

 

Should be in relation to UM6P.Partners. You should check if you create a relation to an uncommitted object. If so you should commit this object before committing the related object.

answered
1

Hi Pradit,

Check your microflows where you are creating an object (instance) of UM6P.Partners. You are also associating other objects with this Partners object and committing those, but fail to commit the Partners object itself in an action. It's state therefor becomes autocommitted and you should prevent that. So either commit the Partners object in an action or delete the created objects before the end of the microflow.

answered