PLS HELP WITH BeanItemContainer??

I’ve a bean like:
public class Supplier {
private int id;
private String supplierName;
private String cableSize;
private String cableType;
private String cableNoOfCore;
private String currentCapacity;
private String cableTermination;
private String cableLength;
private String remarks;

public int getId() {
	return id;
}

public void setId(int id) {
	this.id = id;
}

public String getSupplierName() {
	return supplierName;
}

public void setSupplierName(String supplierName) {
	this.supplierName = supplierName;
}

public String getCableSize() {
	return cableSize;
}

public void setCableSize(String cableSize) {
	this.cableSize = cableSize;
}

public String getCableType() {
	return cableType;
}

public void setCableType(String cableType) {
	this.cableType = cableType;
}

public String getCableNoOfCore() {
	return cableNoOfCore;
}

public void setCableNoOfCore(String cableNoOfCore) {
	this.cableNoOfCore = cableNoOfCore;
}

public String getCurrentCapacity() {
	return currentCapacity;
}

public void setCurrentCapacity(String currentCapacity) {
	this.currentCapacity = currentCapacity;
}

public String getCableTermination() {
	return cableTermination;
}

public void setCableTermination(String cableTermination) {
	this.cableTermination = cableTermination;
}

public String getCableLength() {
	return cableLength;
}

public void setCableLength(String cableLength) {
	this.cableLength = cableLength;
}

public String getRemarks() {
	return remarks;
}

public void setRemarks(String remarks) {
	this.remarks = remarks;
}

}

i connect to database and get a java.util.List contianing the line beans.
i’m using BeanItemContainer to fill it through List:

public class SupplierContainer extends BeanItemContainer implements
Serializable {
/**
* Natural property order for Person bean. Used in tables and forms.
*/
public static final Object NATURAL_COL_ORDER = new Object
{
“id”, “SupplierName”, “CableSize”, “CableType”, “CableNoOfCore”,
“CurrentCapacity”, “CableTermination”,“CableLength”,“Remarks”};

/**
 * "Human readable" captions for properties in same order as in
 * NATURAL_COL_ORDER.
 */
public static final String[] COL_HEADERS_ENGLISH = new String[]

{
“is”, “SupplierName”, “CableSize”, “CableType”, “CableNoOfCore”,
“CurrentCapacity”, “CableTermination”,“CableLength”,“Remarks” };

public SupplierContainer() throws InstantiationException,
		IllegalAccessException {
	super(Supplier.class);
	
}
public static SupplierContainer createWithTestData() {
	SupplierContainer c = null;
	
	try{
		c = new SupplierContainer();
		List<Supplier> suplierList = SuppliersDao.getSupplier();
		for (int i = 0; i < suplierList.size(); i++) {
			Supplier s=suplierList.get(i);
			//c.addBean(s);
			c.addItem(s);
		}
		
	}catch(InstantiationException e){
		e.printStackTrace();
	}catch(IllegalAccessException e){
		e.printStackTrace();
	}
	return c;
}

}

then i populate a table called LineList from the BeanItemContainer and it works fine, but with unordered column headered,so i used the following :

setVisibleColumns(SupplierContainer.NATURAL_COL_ORDER);
setColumnHeaders(SupplierContainer.COL_HEADERS_ENGLISH);

and here’s begining of the problem it through exception :
java.lang.IllegalArgumentException: Ids must exist in the Container or as a generated column , missing id:

anyone can help me in clear w
ay[b]
[b]
to fix this problem

Hi Kadry

I’m not sure, but I think property ids are “supplierName” and not “SupplierName”.

Regards

Hi
thnx for ur replay
i tried out your suggestion it works fine,i think i have to put all properties starting with samll letter like
instead of CableLength must be cableLenght,…
thnak you for ur help.