Hello all!
I hope I am posting to the right section!
In one of my classes I have a OneToMany relationship:
Code:
@OneToMany(cascade = CascadeType.ALL)
@MapKeyColumn(name="keyfield")
@FilterJoinTable(name = "Class.filterName, condition="field = :val)
@JoinTable(name = "child_table",
joinColumns = {@JoinColumn(name = "columnA")},
inverseJoinColumns = {@JoinColumn(name = "columnB")}
)
private Map<Integer,childTable> children;
The class containing what above mentioned is loaded and then "detached" from the session and passed to another method that has to do stuff with it. In the other method, obviously, children is not initialized (which is the expected behaviour for a lazy loading of course, I never accessed it) so I thought that:
Code:
session.enableFilter('filterName').setParameter('param', 'value');
session.update(myObject);
would load the children applying the filter since in that point the query has still to be ran but I was wrong: the collection holds all children, regardless of the filter. To correctly apply the filter I have to get a new object from the session.
Is there a way to update myObject without the need to load a new object from the session?
Thanks in advance!
Stefano