Hi all.
I have the following (part of) model:
Code:
public class A {
Set<B> bs = new HashSet<B>();
// other fields an public access methods (getters/setters)
}
In the DB exists an A element with one B element related to (via A.bs field).
Now, within a transaction, I have added to a element two B elements more. So a instance (in memory) has three B elements related to, but in the database (not session closed yet) only one.
Code:
// Still in the transaction...
daoB.findByA(a).size();
This sentence returns 3 and I think it should return 1. Why returns 3 if the session is not closed still and I have not done "flush"...
However, if I execute a SQL query via TransactionManager.getConnection() the result is the expected, this is, 1.
Any idea?