1 Reply Latest reply on Jul 12, 2008 8:18 AM by Max Rydahl Andersen

    Generating entities problem with equals method in id class

    Elvis D, Novice

      hi all,

      i have a problem with jboss tools (nigthly JBossTools-200806211803-nightly-ALL-linux-gtk) and eclipse canymede 3.4RC4.

      i have created an application via terminal using seam-gen and so on, following instructions in getting started.
      Then i'd like to generate my entities from my existing db (MS SQL 2005, connecting through MS jdbc driver)
      tables are correctly loaded and beans are generated.
      when a table has a composite Id (i.ex. table Account, ID cols are IDAccount and IDCompany) the composite id class is generated (AccountID) and embedded with annotations.
      But in the equals method there are errors that i ignore how to fix them:
      Class AccountGroupId.java

      public boolean equals(Object other) {
       if ((this == other)) // *1
       return true;
       if ((other == null))
       return false;
       if (!(other instanceof AccountGroupId)) //*2
       return false;
       AccountGroupId castOther = (AccountGroupId) other; //*3
       return ((this.getIdgroup() == castOther.getIdgroup()) || (this
       .getIdgroup() != null
       && castOther.getIdgroup() != null && this.getIdgroup().equals(
       && ((this.getIdCompany() == castOther.getIdCompany()) || (this
       .getIdCompany() != null
       && castOther.getIdCompany() != null && this

      *1: Incompatible operand types AccountGroupId and Object
      *2: Incompatible conditional operand types Object and AccountGroupId
      *3: Cannot cast from Object to AccountGroupId

      Any Composite Id class has this three errors... any thoughts?