Refreshing a JPA result list which is bound with a jTable

Posted by exhuma on Stack Overflow See other posts from Stack Overflow or by exhuma
Published on 2010-04-30T07:48:53Z Indexed on 2010/04/30 15:47 UTC
Read the original article Hit count: 246

Filed under:
|
|

First off, I hage to write this on my mobile. But I'll try to format it properly.

In Netbeans I created a jTable and bound it's values to a JPA result set. This works great. The qery contains a param which i set in the pre-create box of the "query result" component. So just before netbeans creates the query result i write this:

myQuery.setParameter("year", "1997");

This works fine. Now, I have an event handler which is supposed to change the param and display the new values in the table. So I do this:

myQuery.setParameter("year", "2005");
myResultList.clear();
myResultList.addAll(myQuery.getResultList());
jTable1.updateUI();

This works, but it feels wrong to me. Note: the result set is bound to the table. So I was hoping there was something like this: myQuery.setParameter("year", "2005"); myResultList.refresh();

Is there something like this?

© Stack Overflow or respective owner

Related posts about java

Related posts about jpa