Error when committing an object inside a Java action

0
I get the following error from mendix when I (believe) I am trying to commit an object in a java action that has been invoked by the system instead of a user. com.mendix.systemwideinterfaces.MendixRuntimeException: Autocommitted objects detected at end of transaction for system session for entities: - x.EmailMessage: 1 instances at com.mendix.basis.action.RequestScope$$anonfun$com$mendix$basis$action$RequestScope$$verifyNoAutoCommitsForSystemSessionExists$1$1.apply(RequestScope.scala:117) at com.mendix.basis.action.RequestScope$$anonfun$com$mendix$basis$action$RequestScope$$verifyNoAutoCommitsForSystemSessionExists$1$1.apply(RequestScope.scala:115) at scala.Option.foreach(Option.scala:257) at com.mendix.basis.action.RequestScope.com$mendix$basis$action$RequestScope$$verifyNoAutoCommitsForSystemSessionExists$1(RequestScope.scala:115) at com.mendix.basis.action.RequestScope$$anonfun$endTransaction$1.apply(RequestScope.scala:131) at com.mendix.basis.action.RequestScope$$anonfun$endTransaction$1.apply(RequestScope.scala:128) at scala.Option.foreach(Option.scala:257) at com.mendix.basis.action.RequestScope.endTransaction(RequestScope.scala:128) at com.mendix.basis.action.ContextImpl.endTransaction(ContextImpl.java:204) at com.mendix.basis.component.InternalCore.commit(InternalCore.java:321) at com.mendix.basis.component.InternalCore.commit(InternalCore.java:188) at com.mendix.basis.component.InternalCore.commit(InternalCore.java:166) at com.mendix.basis.component.InternalCore.commit(InternalCore.java:152) at com.mendix.basis.actionmanagement.UserScheduledAction.executeScheduledAction(ScheduledAction.scala:86) at com.mendix.basis.actionmanagement.ScheduledAction$ScheduledRun$$anonfun$run$1.apply(ScheduledAction.scala:141) at com.mendix.basis.actionmanagement.IMonitoredAction$$anon$1.execute(IMonitoredAction.scala:47) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:33) at com.mendix.basis.actionmanagement.IMonitoredAction$class.monitor(IMonitoredAction.scala:49) at com.mendix.basis.actionmanagement.ScheduledAction$ScheduledRun.monitor(ScheduledAction.scala:132) at com.mendix.basis.actionmanagement.ScheduledAction$ScheduledRun.run(ScheduledAction.scala:141) at com.mendix.basis.actionmanagement.ScheduledAction.execute(ScheduledAction.scala:130) at com.mendix.basis.actionmanagement.ScheduledAction.run(ScheduledAction.scala:111) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Any thoughts of sorting this out? Can I assign a session/user to the object even though the system itself is using the microflow?  
asked
1 answers
1

Autocommitted objects are objects with a reference that have not been committed. Take for example an order with orderlines and you commit the orderlines without committing the order.  So double check your Java code and the microflow around this where you change objects without committing them.

See also the documentation here:https://docs.mendix.com/howto6/working-with-object-events

Regards,

Ronald

 

answered