[jira] [Resolved] (TORQUE-358) HTML and XDOC generation -schema table fields inherits attribute value if not set

"Georg Kallidis (Jira)" <[email protected]>
Newsgroups gmane.comp.jakarta.turbine.torque.devel
Message-ID <[email protected]>
     [ https://issues.apache.org/jira/browse/TORQUE-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Georg Kallidis resolved TORQUE-358.
-----------------------------------
      Assignee: Georg Kallidis
    Resolution: Fixed

- with fixing velocity templates, generation of xdoc and html is now as expected again, Revision: 1871735.

> HTML and XDOC generation -schema table fields inherits attribute value if not set
> ---------------------------------------------------------------------------------
>
>                 Key: TORQUE-358
>                 URL: https://issues.apache.org/jira/browse/TORQUE-358
>             Project: Torque
>          Issue Type: Bug
>          Components: Templates
>    Affects Versions: 4.1
>            Reporter: Georg Kallidis
>            Assignee: Georg Kallidis
>            Priority: Major
>             Fix For: 4.1
>
>
> Changing the example schema (src/test/schema.xml) adding a field e.g
>  
> {code:java}
> <column
> name="contactdata"
> required="true"
> type="VARCHAR"
> size="500"
> />
> {code}
> 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.
>  
> {code:java}
> <column
> name="created_at"
> required="true"
> type="TIMESTAMP"
> default="CURRENT_TIMESTAMP"
> scale="6"
> />
> <column
> name="updated_at"
> required="true"
> type="TIMESTAMP"
> scale="6"
> />
> {code}
>  
>  
> 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? 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.