[jboss-user] [JBoss Tools (users)] - Generating entities problem with equals method in id class

elvisd do-not-reply at jboss.com
Mon Jun 23 07:26:12 EDT 2008


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(
  | 				castOther.getIdgroup())))
  | 				&& ((this.getIdCompany() == castOther.getIdCompany()) || (this
  | 						.getIdCompany() != null
  | 						&& castOther.getIdCompany() != null && this
  | 						.getIdCompany().equals(castOther.getIdCompany())));
  | 	}
  | 
*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?

Kindly
elvisd

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159890#4159890

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159890



More information about the jboss-user mailing list