2 Replies Latest reply on Sep 3, 2009 8:51 PM by Alexander Kunkel

    seam-gen: HowTo use own annotations

    Alexander Kunkel Newbie


      I found the freemarker templates for seam-gen. I guess seam-gen can only respect information which is included in the hibernate metamodel for properties Value.

      I like to modify the templates to respect my own annotations.

      For example:
      I like to create an own annotation @ReadOnly which will not editable.

      String getName() {

      Have anyone a hint for me or the confirmation that currently it is not possible.


        • 1. Re: seam-gen: HowTo use own annotations
          Francisco Jose Peredo Noguez Master

          Yes, it is possible, I have done it.
          You have to create your own utility class to process you annotations.

          Normally, only one utility class is included in the generation process:

          <property key="hibernatetool.util.toolclass" value="org.jboss.seam.tool.Util" />

          you can add your custom one like this:

          <property key="hibernatetool.myextension.toolclass" value="domain.mycompany.MyUtilClass" />

          After that is only a matter of using reflection inside your utility class to process your custom annotations (and of course calling your utility class from your custom freemarker (ftl) templates).

          Take a look at seam-gen ant scripts look for the place where the hibernate task is called.

          • 2. Re: seam-gen: HowTo use own annotations
            Alexander Kunkel Newbie

            Thanks for your reply.

            A little bit more could be helpful.

            I Know to analyse existing annotations with an own utility.
            I know to modify
            I know to set hibernatetool.myextension.toolclass

            I don't know to place my own utility inside of editproperty.xhtml.ftl and which arguments are possible for my utility.

            I fear that i have to analyse seam-gen from scratch.