Description
Today we can import sql files when sql is inline but since javaee 7 introduces json API we should be able to use json (even xml) to do it.
Formats could be:
- for datasources (<datasource>.json in classpath or $tomee_base/data/<datasource>.json):
{ "configuration":{ "rollbackIfError": false, // only for jta datasources }, "data":{ "table1":[ { "column1":"value1", "column2":"value2" }, { "column1":"value1" } ], "table2":[ { "column3":"value" } ] } }
- and for entitymanagers:
{ "configuration":{ "rollbackIfError": false, // only for jta datasources }, "data":{ "org.superbiz.Entity1":[ { "field1":"value1", "field2":"value2" }, { "field1":"value1" } ], "org.superbiz.Entity2":[ { "field3":"value" } ] } }
Tests: should ensure manual inserts works but also for entitymanager case that relationships (n-m and 1-n) work. Since we have the em we can get the metamodel to determine the keys and relationships so it doesn't sound impossible.
Attachments
Issue Links
- links to