I'm using binding machanism to show data from database table in 开发者_高级运维jTable. I've had problem with adding new Element and refreshing jTable, but finally I solved it (observable property in List). Now I want to get Element from jTable, change it (setters) and save changes (flush?). How can I achieve it?
Thanks in advance!
OK, solved.
Element elem = (Element) list.get(jTable.convertRowIndexToModel(jTable.getSelectedRow()));
where:
Element
- entity class
list
- entityManager.createQuery("SELECT e FROM Element e").getResultList();
Make sure list is observable (to see changes in jTable immidiately).
精彩评论