Hello I created an entity with a calculated attribute, which is working quite fine I created an import mapping using the entity and the calculated attribute as per below I get the following warning when i use the import mapping com.mendix.connectionbus.ConnectionBusRuntimeException: Can't find table by alias 'MyFirstModule.DeviceModules' in entity 'MyFirstModule.DeviceModules' and can't find attribute with name 'DeviceIDCalculated' in entity MyFirstModule.DeviceModules while parsing path 'MyFirstModule.DeviceModules/DeviceIDCalculated' at com.mendix.connectionbus.retrieve.OqlRequestHandler.doNewQueryHandling(OqlRequestHandler.scala:234) Caused by: com.mendix.datastorage.handler.QueryHandlingException: Can't find table by alias 'MyFirstModule.DeviceModules' in entity 'MyFirstModule.DeviceModules' and can't find attribute with name 'DeviceIDCalculated' in entity MyFirstModule.DeviceModules while parsing path 'MyFirstModule.DeviceModules/DeviceIDCalculated' at com.mendix.datastorage.handler.QueryTransformationDSL$EitherComplexOrQueryMapper.$tilde$greater(QueryHandler.scala:365) and the following error com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"xpath":"//MyFirstModule.DeviceModules[Code=$var1 and DeviceIDCalculated=$var2]","amount":-1,"variables":{"var2":"10","var1":"BINARY_VALUE_10"},"depth":0,"offset":-1,"sort":{},"type":"RetrieveXPathAction"}', all database changes executed by this action were rolled back at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:159) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"xpath":"//MyFirstModule.DeviceModules[Code=$var1 and DeviceIDCalculated=$var2]","amount":-1,"variables":{"var2":"10","var1":"BINARY_VALUE_10"},"depth":0,"offset":-1,"sort":{},"type":"RetrieveXPathAction"}', all database changes executed by this action were rolled back at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:23) Caused by: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"xpath":"//MyFirstModule.DeviceModules[Code=$var1 and DeviceIDCalculated=$var2]","amount":-1,"variables":{"var2":"10","var1":"BINARY_VALUE_10"},"depth":0,"offset":-1,"sort":{},"type":"RetrieveXPathAction"}', all database changes executed by this action were rolled back at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.processErrorState(CoreActionHandlerImpl.scala:143) Caused by: com.mendix.connectionbus.ConnectionBusRuntimeException: An exception has occurred for the following request(s): InternalXPathTextGetRequest (depth = 0): //MyFirstModule.DeviceModules[Code=$var1 and DeviceIDCalculated=$var2] at com.mendix.connectionbus.RequestAnalyzer.doRequest(RequestAnalyzer.java:63) Caused by: com.mendix.connectionbus.ConnectionBusRuntimeException: Entity 'MyFirstModule.DeviceModules' doesn't contain association 'DeviceIDCalculated'. Entity is used in path 'MyFirstModule.DeviceModules'., exception occurred on mapping the following query: SELECT MyFirstModule.DeviceModules/* FROM MyFirstModule.DeviceModules WHERE (myfirstmodule$devicemodules.code = ? AND MyFirstModule.DeviceModules/DeviceIDCalculated = ?) at com.mendix.connectionbus.retrieve.query.mapping.QueryMapper.getMappedQueries(QueryMapper.java:281) Caused by: com.mendix.connectionbus.ConnectionBusRuntimeException: Entity 'MyFirstModule.DeviceModules' doesn't contain association 'DeviceIDCalculated'. Entity is used in path 'MyFirstModule.DeviceModules'. at com.mendix.connectionbus.retrieve.query.mapping.QueryColumnItemHandler.createAssociationColumnDefinition(QueryColumnItemHandler.java:239) at com.mendix.connectionbus.retrieve.query.mapping.QueryColumnItemHandler.createColumnDefinition(QueryColumnItemHandler.java:168) at com.mendix.connectionbus.retrieve.query.mapping.QueryColumnItemHandler.mapSelectorLocation(QueryColumnItemHandler.java:125) at com.mendix.connectionbus.retrieve.query.mapping.QueryColumnItemHandler.handleQueryWhereTermLocation(QueryColumnItemHandler.java:62) at com.mendix.connectionbus.retrieve.query.mapping.WhereClauseMapper.prehandleWhereTermSide(WhereClauseMapper.java:238) at com.mendix.connectionbus.retrieve.query.mapping.WhereClauseMapper.handleWhereTerm(WhereClauseMapper.java:164) at com.mendix.connectionbus.retrieve.query.mapping.WhereClauseMapper.map(WhereClauseMapper.java:141) at com.mendix.connectionbus.retrieve.query.mapping.WhereClauseMapper.map(WhereClauseMapper.java:129) at com.mendix.connectionbus.retrieve.query.mapping.QueryMapper.mapWhereClauseWhereTerms(QueryMapper.java:745) at com.mendix.connectionbus.retrieve.query.mapping.QueryMapper.getMappedQueries(QueryMapper.java:248) at com.mendix.connectionbus.retrieve.query.mapping.QueryMapper.getQueryInstances(QueryMapper.java:148) at com.mendix.connectionbus.retrieve.OqlRequestHandler.doOldQueryHandling(OqlRequestHandler.scala:198) at com.mendix.connectionbus.retrieve.OqlRequestHandler.handleError$1(OqlRequestHandler.scala:55) at com.mendix.connectionbus.retrieve.OqlRequestHandler.handleRequest(OqlRequestHandler.scala:98) at com.mendix.connectionbus.retrieve.DataStoreCaller.processOqlGetRequest(DataStoreCaller.scala:41) at com.mendix.connectionbus.retrieve.DataStoreCaller.$anonfun$getResult$1(DataStoreCaller.scala:35) at scala.collection.StrictOptimizedIterableOps.flatMap(StrictOptimizedIterableOps.scala:117) at scala.collection.StrictOptimizedIterableOps.flatMap$(StrictOptimizedIterableOps.scala:104) at scala.collection.immutable.ArraySeq.flatMap(ArraySeq.scala:35) at com.mendix.connectionbus.retrieve.DataStoreCaller.getResult(DataStoreCaller.scala:35) at com.mendix.connectionbus.retrieve.DataStoreCaller.getResult(DataStoreCaller.scala:33) at com.mendix.connectionbus.retrieve.GetRequestHandler.doRequest(GetRequestHandler.java:65) at com.mendix.connectionbus.RequestAnalyzer.doRequest(RequestAnalyzer.java:49) at com.mendix.connectionbus.ConnectionBusImpl.doRequest(ConnectionBusImpl.java:516) at com.mendix.basis.action.user.RetrieveXPathRawAction.retrieveXPathRaw(RetrieveXPathRawAction.java:131) at com.mendix.basis.action.user.RetrieveXPathRawAction.executeAction(RetrieveXPathRawAction.java:76) at com.mendix.basis.action.user.RetrieveXPathAction.executeAction(RetrieveXPathAction.java:60) at com.mendix.basis.action.user.RetrieveXPathAction.executeAction(RetrieveXPathAction.java:16) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:63) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:48) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.$anonfun$runMonitoredAction$1(CoreActionHandlerImpl.scala:52) at com.mendix.basis.actionmanagement.ActionMonitoring$.$anonfun$monitor$1(ActionMonitoring.scala:49) at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19) at com.mendix.basis.actionmanagement.ActionMonitoring$.monitor(ActionMonitoring.scala:49) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.runMonitoredAction(CoreActionHandlerImpl.scala:52) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:46) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54) at com.mendix.basis.actionmanagement.ActionManagerBase.lambda$executeSync$0(ActionManagerBase.java:151) at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19) at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:149) at com.mendix.basis.action.InternalXPathQuery.execute(InternalXPathQuery.scala:29) at com.mendix.integration.importer.handlers.ObjectFinder.findInDatabaseInternal(ObjectFinder.scala:69) at com.mendix.integration.importer.handlers.ObjectFinder.findInDatabase(ObjectFinder.scala:57) at com.mendix.integration.importer.handlers.ObjectFinder.$anonfun$find$1(ObjectFinder.scala:26) at scala.Option.orElse(Option.scala:477) at com.mendix.integration.importer.handlers.ObjectFinder.find(ObjectFinder.scala:26) at com.mendix.integration.importer.handlers.ObjectMappingHandler.findObject(ObjectMappingHandler.scala:276) at com.mendix.integration.importer.handlers.ObjectMappingHandler.getObjectViaDefaultAction(ObjectMappingHandler.scala:236) at com.mendix.integration.importer.handlers.ObjectMappingHandler.getObjectImportInfo(ObjectMappingHandler.scala:108) at com.mendix.integration.importer.handlers.ObjectMappingHandler.createObjectInfo(ObjectMappingHandler.scala:127) at com.mendix.integration.importer.handlers.ObjectMappingHandler.$anonfun$endObjectElement$1(ObjectMappingHandler.scala:85) at scala.Option.map(Option.scala:242) at com.mendix.integration.importer.handlers.ObjectMappingHandler.endObjectElement(ObjectMappingHandler.scala:80) at com.mendix.integration.importer.handlers.StreamingHandler.$anonfun$handleElement$1(StreamingHandler.scala:82) at com.mendix.integration.importer.handlers.StreamingHandler.$anonfun$handleElement$1$adapted(StreamingHandler.scala:80) at scala.Option.foreach(Option.scala:437) at com.mendix.integration.importer.handlers.StreamingHandler.handleElement(StreamingHandler.scala:80) at com.mendix.integration.importer.handlers.StreamingHandler.endObject(StreamingHandler.scala:70) at com.mendix.integration.importer.json.JsonStreamingHandler.endElement(JsonStreamingHandler.scala:114) at com.mendix.integration.importer.json.JsonStreamingHandler.parseObject(JsonStreamingHandler.scala:60) at com.mendix.integration.importer.json.JsonStreamingHandler.parseFullArray(JsonStreamingHandler.scala:92) at com.mendix.integration.importer.json.JsonStreamingHandler.parseArray(JsonStreamingHandler.scala:65) at com.mendix.integration.importer.json.JsonStreamingHandler.parseFullObject(JsonStreamingHandler.scala:74) at com.mendix.integration.importer.json.JsonStreamingHandler.parseObject(JsonStreamingHandler.scala:59) at com.mendix.integration.importer.json.JsonStreamingHandler.$anonfun$parse$1(JsonStreamingHandler.scala:38) at com.mendix.integration.util.AutoCloseableUtil$.using(AutoCloseableUtil.scala:10) at com.mendix.integration.importer.json.JsonStreamingHandler.parse(JsonStreamingHandler.scala:30) at com.mendix.integration.importer.json.JsonImporter.$anonfun$parseJson$3(JsonImporter.scala:50) at scala.util.Try$.apply(Try.scala:210) at com.mendix.integration.importer.json.JsonImporter.$anonfun$parseJson$2(JsonImporter.scala:50) at com.mendix.integration.util.AutoCloseableUtil$.using(AutoCloseableUtil.scala:10) at com.mendix.integration.importer.json.JsonImporter.$anonfun$parseJson$1(JsonImporter.scala:49) at com.mendix.integration.util.AutoCloseableUtil$.using(AutoCloseableUtil.scala:10) at com.mendix.integration.importer.json.JsonImporter.parseJson(JsonImporter.scala:48) at com.mendix.integration.importer.json.JsonImporter.parse$1(JsonImporter.scala:37) at com.mendix.integration.importer.json.JsonImporter.$anonfun$importStream$1(JsonImporter.scala:39) at com.mendix.integration.util.ContextUtil$RichContext$.withTransaction$extension(ContextUtil.scala:11) at com.mendix.integration.importer.json.JsonImporter.importStream(JsonImporter.scala:39) at com.mendix.integration.internal.InternalIntegration.doImportStream(InternalIntegration.scala:98) at com.mendix.integration.internal.InternalIntegration.doImportStream$(InternalIntegration.scala:86) at com.mendix.integration.internal.InternalIntegrationImpl.doImportStream(InternalIntegrationImpl.scala:37) at com.mendix.integration.service.rest.microflowarguments.ObjectOrListArgument.$anonfun$apply$2(ObjectOrListArgument.scala:57) at scala.util.Success.flatMap(Try.scala:258) at com.mendix.integration.service.rest.microflowarguments.ObjectOrListArgument.apply(ObjectOrListArgument.scala:43) at com.mendix.integration.service.rest.microflowarguments.RestMicroflowArguments.bodyArgument(RestMicroflowArguments.scala:85) at com.mendix.integration.service.rest.microflowarguments.RestMicroflowArguments.argument(RestMicroflowArguments.scala:67) at com.mendix.integration.service.rest.microflowarguments.RestMicroflowArguments.$anonfun$apply$2(RestMicroflowArguments.scala:42) at scala.collection.Iterator$$anon$9.next(Iterator.scala:575) at scala.collection.mutable.Growable.addAll(Growable.scala:65) at scala.collection.mutable.Growable.addAll$(Growable.scala:60) at scala.collection.immutable.MapBuilderImpl.addAll(Map.scala:692) at scala.collection.immutable.Map$.from(Map.scala:643) at scala.collection.IterableOnceOps.toMap(IterableOnce.scala:1256) at scala.collection.IterableOnceOps.toMap$(IterableOnce.scala:1255) at scala.collection.AbstractIterable.toMap(Iterable.scala:919) at com.mendix.integration.util.IteratorUtil$RichIterable$.toBreakoutMap$extension(IteratorUtil.scala:23) at com.mendix.integration.service.rest.microflowarguments.RestMicroflowArguments.$anonfun$apply$1(RestMicroflowArguments.scala:41) at scala.util.Try$.apply(Try.scala:210) at com.mendix.integration.service.rest.microflowarguments.RestMicroflowArguments.apply(RestMicroflowArguments.scala:41) at com.mendix.integration.service.rest.RestOperationProcessors.getMicroflowResult(RestOperationProcessors.scala:198) at com.mendix.integration.service.rest.RestOperationProcessors.$anonfun$operationResponse$5(RestOperationProcessors.scala:131) at com.mendix.basis.actionmanagement.ActionMonitoring$.$anonfun$monitor$1(ActionMonitoring.scala:49) at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19) at com.mendix.basis.actionmanagement.ActionMonitoring$.monitor(ActionMonitoring.scala:49) at com.mendix.integration.service.rest.RestOperationProcessors.$anonfun$operationResponse$4(RestOperationProcessors.scala:129) at com.mendix.integration.service.rest.RestOperationProcessors.withAuthenticationContext(RestOperationProcessors.scala:161) at com.mendix.integration.service.rest.RestOperationProcessors.$anonfun$operationResponse$3(RestOperationProcessors.scala:124) at com.mendix.integration.service.rest.RestOperationProcessors.operationResponse(RestOperationProcessors.scala:127) at com.mendix.integration.service.rest.RestOperationProcessors.processOperations(RestOperationProcessors.scala:87) at com.mendix.integration.service.rest.RestOperationProcessors.$anonfun$createProcessor$1(RestOperationProcessors.scala:64) at com.mendix.integration.service.PathProcessors.$anonfun$process$3(PathProcessors.scala:31) at scala.Option.fold(Option.scala:263) at com.mendix.integration.service.PathProcessors.$anonfun$process$1(PathProcessors.scala:31) at scala.collection.Iterator$$anon$10.nextCur(Iterator.scala:585) at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:599) at scala.collection.Iterator.isEmpty(Iterator.scala:459) at scala.collection.Iterator.isEmpty$(Iterator.scala:459) at scala.collection.AbstractIterator.isEmpty(Iterator.scala:1279) at com.mendix.integration.util.IteratorUtil$RichIterator$.headOption$extension(IteratorUtil.scala:42) at com.mendix.integration.util.IteratorUtil$RichIterable$.firstDefined$extension(IteratorUtil.scala:29) at com.mendix.integration.service.PathProcessors.process(PathProcessors.scala:28) at com.mendix.integration.service.PathProcessors.process$(PathProcessors.scala:27) at com.mendix.integration.service.rest.RestOperationProcessors.process(RestOperationProcessors.scala:42) at com.mendix.integration.requesthandlers.RestRequestHandler.$anonfun$processRequest$1(RestRequestHandler.scala:38) at scala.collection.Iterator$$anon$10.nextCur(Iterator.scala:585) at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:599) at scala.collection.Iterator.isEmpty(Iterator.scala:459) at scala.collection.Iterator.isEmpty$(Iterator.scala:459) at scala.collection.AbstractIterator.isEmpty(Iterator.scala:1279) at com.mendix.integration.util.IteratorUtil$RichIterator$.headOption$extension(IteratorUtil.scala:42) at com.mendix.integration.util.IteratorUtil$RichIterable$.firstDefined$extension(IteratorUtil.scala:29) at com.mendix.integration.requesthandlers.RestRequestHandler.processRequest(RestRequestHandler.scala:38) at com.mendix.externalinterface.connector.RequestHandler.doProcessRequest(RequestHandler.java:35) at com.mendix.external.connector.MxRuntimeConnector.lambda$processRequest$0(MxRuntimeConnector.java:74) at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19) at com.mendix.external.connector.MxRuntimeConnector.processRequest(MxRuntimeConnector.java:73) at com.mendix.basis.impl.MxRuntimeImplBase.processRequest(MxRuntimeImplBase.java:834) at com.mendix.m2ee.appcontainer.server.handler.RuntimeServlet.service(RuntimeServlet.java:42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791) at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626) at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:228) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:516) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:279) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) at java.base/java.lang.Thread.run(Thread.java:834)
asked
Mohammad Reza Dowlut
2 answers
2
Since the attribute is calculated and not stored, you can not just overwrite it with the value you get from the API. You should remove it from your mapping. It is just not needed there. Since it is calculated, it will be calculated if needed. No need to set it during import.
The main reason of the calculated attribute was for the import mapping. Too bad
The idea behind that was to have a composite key, the parent and the child. Actually, i have only the possibility to check only the key from the child entity before inserting, but i need to have the composite one.