I've been searching and trying for hours now, still can't find a solution that should be obvious. This is my first post, so please be kind.
Using NetBeans 6.9.1, I've created a JTable and drag&dropped a Hibernate MySQL database table onto it. This works well, and fills the JTable with the column headers and rows. I can successfully add rows to the database, but the table is not updated. Looking at the code created by the IDE for a generic desktop database app, I came up with the following code, which seems like it should work, but does not.
private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) { tournamentmarshalPUEntityManager.getTransaction().begin(); java.util.Collection data = tournamentQuery.getResultList(); for (Object entity : data) { tournamentmarshalPUEntityManager.refresh(entity); } tournamentList.clear(); tournamentList.addAll(data); tournamentmarshalPUEntityManager.getTransaction().commit(); System.out.println("refreshing"); }
Do I need to be thinking about firePropertyChange() to solve this?
I've seen this question asked online many different ways, and nobody had written a clear concise answer as yet. Thanks in advance for your thoughtful, considered answers!