Uploaded image for project: 'Torque'
  1. Torque
  2. TORQUE-358

HTML and XDOC generation -schema table fields inherits attribute value if not set

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.0
    • 5.0
    • Templates
    • None

    Description

      Changing the example schema (src/test/schema.xml) adding a field e.g

       

      <column
      name="contactdata"
      required="true"
      type="VARCHAR"
      size="500"
      />
      

      in table "a" after field "name" having a default value ("a_name") the HTML and XDOC outputs for field "contactdata" the default value from the preceding field. This happens only if it is a column with another column of the same type is set before. As a consequence the tests in JUNit - Test TestProcessing fail (test*docTemplate) - SQL and OM classes generation is not affected.

       

      Another example of a schema.xml change. Result is that CURRENT_TIMESTAMP is in HTML/XDOC output for both fields (created_at, updated_at), while SQL and Java generation is done correctly.

       

      <column
      name="created_at"
      required="true"
      type="TIMESTAMP"
      default="CURRENT_TIMESTAMP"
      scale="6"
      />
      <column
      name="updated_at"
      required="true"
      type="TIMESTAMP"
      scale="6"
      />
      

       

       

      Fixing seems to me not easy as far as I can see - some complex velocity inheritance mechanism (velocity 1.7) is used, the fields seems to inherit from  other fields in the same table.

      Workaround may be done by overriding explicitely the attribute resetting it in schema.xml.

      But I think this feature is neither at the core of Torque nor it is documented (I did not know about it before).

      https://db.apache.org/torque/torque-4.0/index.html states quite lakonikely:

      torque-templatesThe Torque Templates contain the building blocks used by the generator to create the O/R classes, SQL scripts and the like. You can extend or change the templates if you want to customize the output of the generator, or even write templates of your own.

      Generation of SQL and OM classes is not concerned (apparently uses different code). What about, just skipping this (almost unknown) feature (HTML and XDOC generation), until it is fixed/reimplemented in an upcoming release? 

      Attachments

        Activity

          People

            gk Georg Kallidis
            gm_kall Georg Kallidis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: