I recommend you to create entity type for your query result, so that you get typed list as a result. Then it is much easier to use it. For example you can give that list then directly to Grid.setItems(result), since list is collection.
Hi Tatu,
thanks for this. i created a entiy class with the example given.
as i create this methods in a another ejb so that another appclient module can access this. however i find that the values of each entity exist during query but it is not transfer over to the webapp. any idea what have i miss out?
also the put methods does not seem to be required or access?
package Model;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
*
* @author weilianghome
*/
@Entity
public class RecentJobs {
@Id
private Integer jobNo;
private String itemcode;
private Date date;
private Date deliveryDate;
private String jobTitle;
private String coyName;
private String firstName;
private int deliveryQty;
private double openSizeWidth;
private double openSizeLength;
private int frontColour;
private int backColour;
public RecentJobs() {
}
/**
* Generic put method to map JPA native Query to this object.
*
* @param column
* @param value
*/
public void put(Object column, Object value) {
switch (((String) column)) {
case "jobNo": {
setJobNo((Integer) value);
System.out.println("jobNo");
}
default:
System.out.println("invalid case: " + ((String) column));
}
}
public Integer getJobNo() {
return jobNo;
}
public void setJobNo(Integer jobNo) {
this.jobNo = jobNo;
}
public String getItemcode() {
return itemcode;
}
public void setItemcode(String itemcode) {
this.itemcode = itemcode;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Date getDeliveryDate() {
return deliveryDate;
}
public void setDeliveryDate(Date deliveryDate) {
this.deliveryDate = deliveryDate;
}
public String getJobTitle() {
return jobTitle;
}
public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}
public String getCoyName() {
return coyName;
}
public void setCoyName(String coyName) {
this.coyName = coyName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public int getDeliveryQty() {
return deliveryQty;
}
public void setDeliveryQty(int deliveryQty) {
this.deliveryQty = deliveryQty;
}
public double getOpenSizeWidth() {
return openSizeWidth;
}
public void setOpenSizeWidth(double openSizeWidth) {
this.openSizeWidth = openSizeWidth;
}
public double getOpenSizeLength() {
return openSizeLength;
}
public void setOpenSizeLength(double openSizeLength) {
this.openSizeLength = openSizeLength;
}
public int getFrontColour() {
return frontColour;
}
public void setFrontColour(int frontColour) {
this.frontColour = frontColour;
}
public int getBackColour() {
return backColour;
}
public void setBackColour(int backColour) {
this.backColour = backColour;
}
}