Hi,
Trying to use the DataModelSelectionIndex to pick up particular row of data and
use it to do another query from other Action.java. I am not sure if I have done
it right or not. I just can't get the data from the database.
this is what I have done. Have been stuck on it for a while. Appreciate any
help.
| @DataModel
| private List<Customer > customers;
| @DataModelSelectionIndex
| private int customerIndex;
|
| @Out(required=false)
| private Customer customer;
|
| @Factory("customers")
| public void findCustomers()
| {
| customers = em.createQuery("select c from customer c").getResultList();
| }
|
| public String selectcustomer()
| {
| setcustomer();
| return("selected");
| }
|
| public void setcustomer()
| {
| customer= customers.get(customerIndex);
| }
|
And I inject customer on the other Action.java and use it to query for related
data. but it doesn't work. Am I doing it wrong?
Here's the code for second Action.java
| @In
| private Customer customer;
|
| @DataModel
| private List<Result> results;
|
| public void getResult()
| {
|
| results = em.createQuery("select r from Result r where r.subscription_id =
:SID")
| .setParameter("SID", patient.getId())
| .getResultList();
|
| }
|
build and deploy successfully but just not returning anything from getResult, a
blank page. I have no idea why.
Regards,
Andy
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078333#4078333
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078333
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user