0 Replies Latest reply on Dec 24, 2008 4:04 PM by jkronegg

    Seam-gen generate EntityHome with compile errors for some specific field names

    jkronegg

      Hi all,


      I have a table A and a table B. The table B has a column named EVENT and a foreign key on table A.


      I used the Eclipse GUI method by JbossTools 3.0.0.CR1 on Seam 2.1.1.GA to generate the entities (New\Seam generate entities).


      When Seam-gen generate the entities, the AHome EntityHome has the following method:


      public List<Event> getEvents() {
           ...
      }
      



      This method cannot be compiled because a method with the same name is already defined in one of the parent class but the return type is not the same (i.e. in org.jboss.seam.framework.Controller: protected org.jboss.seam.core.Events getEvents() ).


      To solve this problem, I see two solutions:



      1. rename the AHome.getEvents() into AHome.getEventsForCurrentInstance()

      2. change the property name in the seam-gen.reveng.xml file from EVENT to something like EVENT2



      The first solution would be the simpliest one as I only need to change a method name when there is a compile error (but I need to do it every time the EntityHome is re-created).


      Is there some automatic solution around to prevent that kind of errors (e.g. in Seam-gen configuration)?


      For example, thinking about a reserved property name list which contain the prohibited names of all properties in the same case. For the Controller class, it would be:



      • event => getEvents()

      • facesMessage => getFacesMessages()

      • message => getMessages()

      • ...



      Best