[jboss-user] [JBoss Seam] - Re: DataModal and a4j:support
mrohad
do-not-reply at jboss.com
Thu Aug 16 12:40:09 EDT 2007
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();
| }
|
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074915#4074915
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074915
More information about the jboss-user
mailing list