max wrote:
if you want a different behavior then look at column.hbm.ftl
I modified column.hbm.ftl. Now it looks like this.
Code:
<#if column.isFormula()>
<formula>${column.getFormula()}</formula>
<#else>
<column name="${column.quotedName}" ${c2h.columnAttributes(column)}>
<#if column.comment?exists>
<comment>${column.comment}</comment>
</#if>
</column>
<meta attribute="length">${column.length}</meta>
</#if>
It contains a meta-attribute length with the correct length. The XML file looks fine. I can see my meta attribute. e.g.
Code:
...
<property name="hitword" type="java.lang.String">
<column name="HITWORD" not-null="true"></column>
<meta attribute="length">255</meta>
</property>
...
But in my templates generating the annotated classes the meta attribute is not found resp. accessing it causes an exception.
Code:
...
${property.getMetaAttribute("length").getValue()}
...
Code:
Caused by: freemarker.core.InvalidReferenceException: Expression property.getMetaAttribute("length") is undefined on line 41, column 18 in pojo/PojoPropertyAccessors.ftl.
Can you give me a hint, why it's ignored here? I saw that the public method getMetaAttribute(String) exists in org.hibernate.mapping.Property! Are there only meta tags allowed mentioned in the doc as "Supported meta tags"? Formerly the meta tag length was valid (we used it). If it behaves like this, it would be impossible to store any information I want to use in my templates in a meta tag which I can compute in the templates. If the unknown meta tag will be ignored by other tools, this wouldn't matter.
Thanks,
Axel