Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1380

study a better data importer for datsources and entitymanagers

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 10.0.0-M3
    • None
    • None

    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

          Activity

            People

              evaldoapjunior Evaldo Junior
              romain.manni-bucau Romain Manni-Bucau
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m