1 Reply Latest reply on Aug 23, 2009 11:23 PM by johog

    Problem with seamgen generate-ui on composite primarykey

    johog

      Seamgen throws ExporterException when I try to generate user interface for an entity with composite primarykey. I got the following error:


      jar:
      
      [hibernate] Executing Hibernate Tool with a JPA Configuration
      
      [hibernate] 1. task: generic exportertemplate: view/list.xhtml.ftl
      
      [hibernate] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
      
      [hibernate] log4j:WARN Please initialize the log4j system properly.
      
      [hibernate] An exception occurred while running exporter #2:generic exportertemplate: view/list.xhtml.ftl
      
      [hibernate] To get the full stack trace run ant with -verbose
      
      [hibernate] org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: st.horting.leagbench.entity.ShootCase with template view/list.xhtml.ftl
      
      [hibernate] freemarker.template.TemplateModelException: No signature of method isComponent matches (java.lang.Object)
      
      
      
      BUILD FAILED
      
      /home/johan/Software/jboss-seam-2.2.0.GA/seam-gen/build.xml:1598: org.hibernate.tool.hbm2x.ExporterException: Error while processing Entity: st.horting.leagbench.entity.ShootCase with template view/list.xhtml.ftl
      
      Entity class:
      @Entity
      @IdClass(ShootCasePK.class)
      public class ShootCase implements Serializable
      {
         private ShootCasePK pk = new ShootCasePK(); 
         private TestCase testCase;
         private int execTime;
         private Set<ShootCaseRound> shootCaseRounds = new HashSet<ShootCaseRound>();
         private Appraisal appraisal;
         
         
         /**
          * @return the pk
          */
         @Transient
         public ShootCasePK getPk()
         {
            return this.pk;
         }
      
         /**
          * @return the shootId
          */
         @Id
         public Integer getShootId()
         {
            return this.pk.getShootId();
         }
      
         /**
          * @return the caseId
          */
         @Id
         public Integer getCaseId()
         {
            return this.pk.getCaseId();
         }
      
         @ManyToOne
         @JoinColumn(name="caseId", referencedColumnName="id",
               insertable=false, updatable=false)
         public TestCase getTestCase()
         {
            return testCase;
         }
         
         @OneToMany
         @JoinColumns({@JoinColumn(name="shootId"),@JoinColumn(name="caseId")
        })
         public Set<ShootCaseRound> getShootCaseRounds()
         {
            return this.shootCaseRounds;
         }
         
         /**
          * @return the execTime
          * Execution time for test shoot of test case in seconds.
          */
         @Column(nullable=true)
         public int getExecTime()
         {
            return this.execTime;
         }
         
         /**
          * @return the appraisal
          */
         @Enumerated(EnumType.ORDINAL)
         public Appraisal getAppraisal()
         {
            return this.appraisal;
         }
      
         /**
          * @param shootId the shootId to set
          */
         public void setShootId( Integer shootId )
         {
            this.pk.setShootId( shootId );
         }
      
         /**
          * @param caseId the caseId to set
          */
         public void setCaseId( Integer caseId )
         {
            this.pk.setCaseId( caseId );
         }
         
         /**
          * @param testCase the testCase to set
          */
         public void setTestCase( TestCase testCase )
         {
            this.testCase = testCase;
         }
      
         /**
          * @param shootCaseRounds the shootCaseRounds to set
          */
         public void setShootCaseRounds( Set<ShootCaseRound> shootCaseRounds )
         {
            this.shootCaseRounds = shootCaseRounds;
         }
      
         /**
          * @param execTime the execution time to set
          */
         public void setExecTime( int execTime )
         {
            this.execTime = execTime;
         }
      
         /* (non-Javadoc)
          * @see java.lang.Object#equals(java.lang.Object)
          */
         @Override
         public boolean equals( Object obj )
         {
            if (obj == this)
               return true;
            if ( ! (obj instanceof ShootCase))
               return false;
            ShootCase that = (ShootCase)obj;
            return this.pk.equals( that.pk );
         }
      
         /* (non-Javadoc)
          * @see java.lang.Object#hashCode()
          */
         @Override
         public int hashCode()
         {
            return this.pk.hashCode();
         }
      
         
         /**
          * @param appraisal the appraisal to set
          */
         public void setAppraisal( Appraisal appraisal )
         {
            this.appraisal = appraisal;
         }  
      }
      
      Primarykey class:
      public class ShootCasePK implements Serializable
      {
         private Integer shootId;
         private Integer caseId;
         
         public ShootCasePK()
         { 
            this(0,0);
         }
      
         public ShootCasePK(Integer shootId, Integer caseId)
         {
            this.shootId = shootId;
            this.caseId = caseId;
         }
         
         /**
          * @return the shootId
          */
         public Integer getShootId()
         {
            return this.shootId;
         }
         
         /**
          * @param shootId the shootId to set
          */
         public void setShootId( Integer shootId )
         {
            this.shootId = shootId;
         }
         
         /**
          * @return the caseId
          */
         public Integer getCaseId()
         {
            return this.caseId;
         }
         
         /**
          * @param caseId the caseId to set
          */
         public void setCaseId( Integer caseId )
         {
            this.caseId = caseId;
         }
      
         /* (non-Javadoc)
          * @see java.lang.Object#equals(java.lang.Object)
          */
         @Override
         public boolean equals( Object obj )
         {
            if (obj == this)
               return true;
            if ( ! (obj instanceof ShootCasePK))
               return false;
            ShootCasePK pk = (ShootCasePK)obj;
            if ( ! shootId.equals( pk.shootId ))
               return false;
            if ( ! caseId.equals( pk.caseId ))
               return false;
            return true;
         }
      
         /* (non-Javadoc)
          * @see java.lang.Object#hashCode()
          */
         @Override
         public int hashCode()
         {
            return (shootId.intValue() * 149) + caseId.intValue();
         }   
      }