4 Replies Latest reply on Mar 19, 2014 5:37 PM by Tom Arnold

    Storing per-model-instance data

    Tom Arnold Novice

      Is there a recommended place for storing per-model-instance data in a translator, for use during execution?

       

      For example, in my translator I have some mapping information that I load from a config file in getMetadata(). I use this to add tables/columns to the model. I have some additional information here like how to map the results to the model, what to use in the querystring for filtering, etc. Currently I'm using instance variables in the execution factory, but I just realized that these are shared across all models using that translator.

       

      Would appreciate some guidance.

       

      Thanks,

      Tom

        • 1. Re: Storing per-model-instance data
          Ramesh Reddy Master

          Tom,

           

          This is where the "extension metadata" properties come into picture. These are same as ones you define in OPTIONS clause if you are defining DDL for your schema on model. So in effect you can define these properties in your translator, and set those properties on a table, column, procedure and/key where you see fit. Then these properties become part of your schema definition and will be send back to you along with user query to the translator. During the execution you can read them back from metadata object and take further decisions on the query planning and execution.

           

          HTH

           

          Ramesh..

          • 2. Re: Storing per-model-instance data
            Tom Arnold Novice

            Thanks Ramesh!

             

            I ended up using setProperty() on Table/Column to do this programmatically (as opposed to DDL/DDL-FILE). This seems to work.

             

            Is there a note on this in the documentation?

             

            Tom

            • 3. Re: Storing per-model-instance data
              Ramesh Reddy Master

              Tom,

               

              Yes, I do mean you need to use the "setProperty" on the metadata object of schema elements of table, column etc. I gave DDL as reference to how this was used in DDL. I thought there was note in the documentation but I could not find any, will add. IMO the Developer's Guide really needs to some face lift to make it more consumable using a simple example. May be you can contribute to the doc?

               

              Thanks

               

              Ramesh..

              • 4. Re: Storing per-model-instance data
                Tom Arnold Novice

                There are a couple of places that could use a little more detail. I've been leaving comments and submitting a few edits. I'll see what I can do.

                 

                Thanks,

                Tom