How to import data to mendix tables

0
Hi, all. Recently I am trying to import data into some of my mendix mysql tables. I just try 2 things to make sure we can import data smoothly I create a model in mendix modeler, with a province table and a city table; of cause city table is associated with province table in 1-* relation. I used to have this 2 tables in mysql, so I just want to copy data into this to table and also fill the relation table too The problem is , how can I generate the id for my imported data? I just fill the id column with numbers and get an error: java.lang.IllegalArgumentException: Entity id should be not zero at com.mendix.basis.objectmanagement.SchemeManagerImplBase.getObjectType(SchemeManagerImplBase.java:391) at com.mendix.basis.objectmanagement.MendixIdentifier.getObjectType(MendixIdentifier.java:85) at com.mendix.basis.objectmanagement.MendixIdentifier.toString(MendixIdentifier.java:132) at com.mendix.basis.action.user.RetrieveIdListAction.$anonfun$new$4(RetrieveIdListAction.scala:30) at scala.collection.immutable.List.map(List.scala:286) at com.mendix.basis.action.user.RetrieveIdListAction.<init>(RetrieveIdListAction.scala:30) at com.mendix.basis.component.InternalCore.createRetrieveIdListAction(InternalCore.scala:224) at com.mendix.basis.component.InternalCore.retrieveIdList(InternalCore.scala:304) at com.mendix.webui.actions.client.RegularClientActions$.retrieveByIds(RegularClientActions.scala:100) at com.mendix.webui.actions.client.RegularClientActionWiring.$anonfun$regularClientActionMap$6(RegularClientActionWiring.scala:27)  
asked
3 answers
3

Are all the attribute names in your mendix entity equal to the column names in mysql? If not, you need to work with aliases in your sql statement.

answered
2

Oh, and something different: You should not manually change the id column in a mendix database. It is an internal column that is maintained by mendix.

answered
1

Is there a reason why do you want to do this with SQL queries? Where do you have the data from? Why did you don’t build out a data handling in Mendix? Then you can make sure that all associations and created data is correctly set up?

answered