2 Replies Latest reply on Sep 18, 2008 11:45 AM by Ivan Pazmino

    Seam Auto-generated code

    Ivan Pazmino Newbie


      I was following a small seam example, and created a couple of entities, a session bean for the logic and a view xhtml file. Then, I generated the EB with the tools and they were far better.

      The problem is that afterward I realized that for the Customer, it had created, besides the EB:

      two SB, one extending from EntityHome (CustomerHome) and other extending EntityQuery (CustomerList).
      three .xhtml pages: Customer.xhtml, CustomerEdit.xhtml and CustomerList.xhtml
      three .xml files: Customer.page.xtml, CustomerEdit.page.xtml and CustomerList.page.xtml

      So, I don't get a few things.

      If I had a class or any file that matched the generated files' name, would it have been overwritten and lost what I had done?
      Can I specify what I want to be generated?
      What do the abstract classes, EntityHome and EntityQuery, do or are for?
      What are those xmls, that seem to be one per .xhtml, for?

      Sorry if these are obvious questions, but I was just beginning and now lost.

      Thanks in advance.

        • 1. Re: Seam Auto-generated code
          Max Rydahl Andersen Master

          For now the generation overwrites content.

          You can specify which entities you want generated via reveng.xml.

          Customization of what type of files you want generated is editable if you go to Run > Hibernate Code generation and edit the properties of the "generate entities" launch. (if you want the changes to stay around copy the launch and use the copy as the original gets updated when you run the seam generate entities wizard)

          About what all the files do I would recommend you read the Seam documentation about pages.xml navigation and/or ask on the seam forum.

          • 2. Re: Seam Auto-generated code
            Ivan Pazmino Newbie

            Thanks a lot Max!

            Just in case someone else needs:

            In the Hibernate Code Generation Dialog, the Main tab allows you to configure the set of entities you want to generated code for, by creating an hibernate.reveng.xml file. Afterward, this file can be edited as a normal xml file with a couple of helpful specific views.

            At the Exporters tab, there is a list of exporters. Each one of these, are a template that describes one of the files that are to be created. So one describes how the ClassNameList.xhtml is going to be created, and other, has the description for ClassNameList.page.xml.

            This is just a 10000 m view over the most important features you could configure here, but there is plenty to learn still.