title: Invalid Identifier While Joining Tables in JPA
body: <p>I am trying to join 3 tables in JPA. When i am trying to associate CRL_IC_IMPORT_TRANS table i am getting error as Invalid Identifier as shown below</p>
  <pre><code>         from
              crl_ic investorco0_ 
          left outer join
              crl_ic_import_trans icimporttr1_ 
                  on investorco0_.icimport_trans_event_id=icimporttr1_.event_id 
          left outer join
              crl_ic_order investorco2_ 
                  on investorco0_.current_order_id=investorco2_.id
      &quot;INVESTORCO0_&quot;.&quot;ICIMPORT_TRANS_EVENT_ID&quot;: invalid identifier
  </code></pre>
  <p>Edit</p>
  <pre><code>from
      crl_ic investorco0_ 
  left outer join
      crl_ic_order investorco1_ 
          on investorco0_.current_order_id=investorco1_.id 
  </code></pre>
  <p>Error:</p>
  <pre><code>Provided id of the wrong type for class ICImportTrans. Expected: class java.lang.Long, got class java.lang.String 
  </code></pre>
  <p>Why its going to primary key in ICImportTrans class even after i mapped to a non PK ?</p>
  <p>Below are my 3 tables and its keys. What is the mistake i am doing .</p>
  <pre><code>    @Table(name = &quot;CRL_IC&quot;)
      public class ICLoanOrder {
            @Id
            @Column(name=&quot;EVENT_ID&quot;)
            String id;
  
            @OneToOne(cascade = CascadeType.ALL)
            @JoinColumn(name = &quot;EVENT_ID&quot;,referencedColumnName = &quot;eventId&quot; )
            ICImportTrans iCImportTrans;
  
            @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
            ICOrder currentOrder;  
       } 
           
       @Table(name = &quot;CRL_IC_ORDER&quot;)
       public class ICOrder implements Serializable {
  
            @Id
            @GenericGenerator(name = &quot;UUIDGenerator&quot;, strategy = &quot;uuid2&quot;)
            @GeneratedValue(generator = &quot;UUIDGenerator&quot;)
            @Type(type = &quot;uuid-char&quot;)
            UUID id;
  
            @ManyToOne(fetch = FetchType.LAZY)
            @JsonIgnore
            @JoinColumn(name=&quot;EVENT_ID&quot;)
            ICLoanOrder iCLoanOrder;
            
       }
            
       @Table(name = &quot;CRL_IC_IMPORT_TRANS&quot;)
       public class ICImportTrans implements Serializable {
  
            @Id
            @GeneratedValue(strategy= GenerationType.SEQUENCE, generator=&quot;SEQ1&quot;)
            @SequenceGenerator(name=&quot;SEQ1&quot;,sequenceName = &quot;SEQ_IC_IMPORT&quot;,allocationSize = 1)
            @Column(name=&quot;PROCESS_ID&quot;)
            private Long processId;
            
            private String eventId;
      }
  </code></pre>