You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2014/10/05 14:55:33 UTC

[jira] [Created] (TOMEE-1380) study a better data importer for datsources and entitymanagers

Romain Manni-Bucau created TOMEE-1380:
-----------------------------------------

             Summary: study a better data importer for datsources and entitymanagers
                 Key: TOMEE-1380
                 URL: https://issues.apache.org/jira/browse/TOMEE-1380
             Project: TomEE
          Issue Type: New Feature
            Reporter: Romain Manni-Bucau
            Priority: Minor


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):

{code}
{
   "configuration":{
       "rollbackIfError": false, // only for jta datasources
   },
   "data":{
      "table1":[
         {
             "column1":"value1",
             "column2":"value2"
        },
        {
             "column1":"value1"
        }
      ],
      "table2":[
         {
             "column3":"value"
        }
      ]
   }
}
{code}

- and for entitymanagers:

{code}
{
   "configuration":{
       "rollbackIfError": false, // only for jta datasources
   },
   "data":{
      "org.superbiz.Entity1":[
         {
             "field1":"value1",
             "field2":"value2"
        },
        {
             "field1":"value1"
        }
      ],
      "org.superbiz.Entity2":[
         {
             "field3":"value"
        }
      ]
   }
}
{code}

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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)