I have 2 entity classes which both have collections of each other's type in many-many config. something like the code below:-
@entity
@Table(name = "A")
...
@JoinTable(name = "JOIN_TBL",
joinColumns = @JoinColumn(name = "COL_ID"),
inverseJoinColumns = @JoinColumn(name = "J_COL_ID"))
private Collection<B> BCollection;
...
and then
@entity
@Table(name = "B")
...
@ManyToMany(mappedBy = "sembookingsCollection", cascade=CascadeType.ALL,fetch=FetchType.EAGER)
private Collection<A> ACollection;
..
Within the application I bind ACollection to a JTable...
org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement.ACollection}");
org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, eLProperty, detailTable);
The above is all pretty standard stuff and my JTable doesn't get updated after changes to ACollection.
I can see I an Observable wrapper around the ACollection might do the trick but Observable Lists are not supported in the JPA spec. for entity classes.
Setting fetchType to EAGER doesn't solve the problem (and perhaps it shouldn't).
Apart from observable lists I can't see how to update a list in real time. Does anyone have a solution to this issue?
many thanks,