I have the same server localy with the same settings than a remote server where the app would be deployed in porduction.
When I deploy the app to remote server the p:dataTable are empty. Only the tables that uses primefaces LazyDataModel are empty.
There is no error in log.
I have also tried to deploy the maven build ear taht I deploy to reomote server also on a local server and localy is working as it should. Obviously there si some difference on the remote server but I can not see what it could be, the standalone.xml are the same localy and remotly
Any hints what coud cause this strange behaviour?
I have put some prints to see what is heppening in the code and in the count method I get 4520 returned, so the sql is working ok the porbem is thet in the xhtml if I put #{billsBean.billsData.rowCount} just before the table where the data should be I get 0. On the local macine for the same view and the same code I get 4520
So it looks like the data gets lost somewhere in the rendering of the table.
Code: Select all
@Named
@Stateless
public class LazyBillsDataModel extends LazyDataModel<Bill> implements Serializable {
private static final long serialVersionUID = -6488655263171321725L;
@Inject
@DomainsDB
private EntityManager em;
@EJB
BillHandler billHandler;
@Inject private Logger log;
public LazyBillsDataModel() {
super();
}
@Override
public List<Bill> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
System.out.println(">>>>>>>> enetering load data for BILLS");
log.debug(">>>>>>>> enetering load data for BILLS");
if (sortField == null || sortField.equals("")) {
sortField = "bill.dateCreate";
}
List<Bill> data = selectData(first, pageSize, sortField, DataUtilsWeb.transformSortOrder(sortOrder), filters);
// row count
this.setRowCount(count(filters));
return data;
}
private int count(Map<String, String> filters) {
String hql = "select count(bill.idBill) from Bill bill ";
if (filters != null && filters.size() > 0) {
hql += " where " + prepereWhereFilters(filters);
}
Query querry = em.createQuery(hql);
fillQueryWitkFilterData(querry, filters);
System.out.println(">>>>>>>> count " + ((Long) querry.getSingleResult()).intValue());
return ((Long) querry.getSingleResult()).intValue();
}
@SuppressWarnings("unchecked")
private List<Bill> selectData(int first, int pageSize, String sortField, String sortOrder, Map<String, String> filters) {
List<Bill> data = new ArrayList<Bill>();
String hql = "select bill from Bill bill left join fetch bill.organization left join fetch bill.billType left join fetch bill.billStatus ";
if (filters != null && filters.size() > 0) {
hql += " where " + prepereWhereFilters(filters);
}
// sorting
if (sortField != null && !sortField.equals("")) {
hql += " order by " + sortField;
if (sortOrder != null && !sortOrder.equals("")) {
hql += " " + sortOrder;
}
}
Query querry = em.createQuery(hql);
fillQueryWitkFilterData(querry, filters);
// define query boundaries
querry.setFirstResult(first);
querry.setMaxResults(pageSize);
data = (List<Bill>) querry.getResultList();
System.out.println(">>>>>>>> BILLS laoded num : " + data.size());
log.debug(">>>>>>>> BILLS laoded num : " + data.size());
return data;
}
......
}