This content has been marked as final.
Show 1 reply
-
1. Re: DataModal and a4j:support
mrohad Aug 16, 2007 12:40 PM (in response to mrohad)I've 2 problems
1)when I'm calling selectCustomerFromTable i am always getting the first row
2) when I calling the update method updatecustomer is empty...
any idea?@Scope(ScopeType.CONVERSATION) @Name("customerList") public class CustomerList extends EntityQuery { private static final String[] RESTRICTIONS = { "lower(customer.name) like concat(lower(#{customerList.customer.name}),'%')", "lower(customer.shortName) like concat(lower(#{customerList.customer.shortName}),'%')", "lower(customer.address) like concat(lower(#{customerList.customer.address}),'%')", "lower(customer.address2) like concat(lower(#{customerList.customer.address2}),'%')", "lower(customer.phoneNumber) like concat(lower(#{customerList.customer.phoneNumber}),'%')", "lower(customer.phoneNumber2) like concat(lower(#{customerList.customer.phoneNumber2}),'%')", "lower(customer.fax) like concat(lower(#{customerList.customer.fax}),'%')",}; private Customer customer = new Customer(); @DataModel List<Customer> customers = null; public List<Customer> getCustomers(){ customers = (List<Customer>) getResultList(); return customers; } private Customer updateCustomer = new Customer(); @Override public String getEjbql() { return "select customer from Customer customer"; } @Override public Integer getMaxResults() { return 25; } public Customer getCustomer() { return customer; } @Override public List<String> getRestrictions() { return Arrays.asList(RESTRICTIONS); } public void selectCustomerFromTable(ActionEvent event){ int x = 1; updateCustomer = (Customer) getDataModelSelection(); } public Customer getUpdateCustomer() { return updateCustomer; } public void update(ActionEvent event){ getEntityManager().persist(updateCustomer); getEntityManager().flush(); } }