Hi All, Working my way through the tutorial and noticed that if you follow the instructions under "Preparing data for an entity" there is a picture that shows how to load the XML data, except that it's backwards.
If you load the data in the order shown in the picture you will get an error message: ERROR: parsing file: ERROR parsing Entity Xml file: org.xml.sax.SAXException: A transaction error occurred reading data<br/>org.apache.ofbiz.entity.GenericEntityException: org.apache.ofbiz.entity.GenericEntityException: org.apache.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:OfbizDemo][comments,This is test comment for first record.(java.lang.String)][createdStamp,2022-01-04 15:14:48.138(java.sql.Timestamp)][createdTxStamp,2022-01-04 15:14:48.137(java.sql.Timestamp)][firstName,Sample First 1(java.lang.String)][lastName,Sample Last 1(java.lang.String)][lastUpdatedStamp,2022-01-04 15:14:48.138(java.sql.Timestamp)][lastUpdatedTxStamp,2022-01-04 15:14:48.137(java.sql.Timestamp)][ofbizDemoId,SAMPLE_DEMO_1(java.lang.String)][ofbizDemoTypeId,INTERNAL(java.lang.String)] (SQL Exception while executing the following:INSERT INTO OFBIZ.OFBIZ_DEMO (OFBIZ_DEMO_ID, OFBIZ_DEMO_TYPE_ID, FIRST_NAME, LAST_NAME, COMMENTS, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table 'OFBIZ_DEMO' caused a violation of foreign key constraint 'ODEM_OD_TYPE_ID' for key (INTERNAL). The statement has been rolled back.)) You need to change the order of the text to load the OfbizDemoType data before you load the OfbizDemoData as shown below. <entity-engine-xml> <OfbizDemoType ofbizDemoTypeId="INTERNAL" description="Internal Demo - Office"/> <OfbizDemoType ofbizDemoTypeId="EXTERNAL" desctiption="External Demo - On Site"/> <OfbizDemo ofbizDemoId="SAMPLE_DEMO_1" ofbizDemoTypeId="INTERNAL" firstName="Sample First 1" lastName="Sample Last 1" comments="This is test comment for first record."/> <OfbizDemo ofbizDemoId="SAMPLE_DEMO_2" ofbizDemoTypeId="INTERNAL" firstName="Sample First 2" lastName="Sample last 2" comments="This is test comment for second record."/> <OfbizDemo ofbizDemoId="SAMPLE_DEMO_3" ofbizDemoTypeId="EXTERNAL" firstName="Sample First 3" lastName="Sample last 3" comments="This is test comment for third record."/> <OfbizDemo ofbizDemoId="SAMPLE_DEMO_4" ofbizDemoTypeId="EXTERNAL" firstName="Sample First 4" lastName="Sample last 4" comments="This is test comment for fourth record."/> </entity-engine-xml>
