Hi Max
Maybe you could add the possibility of adding querySpaces to the query. So that you can tell hibernate wich tables to flush in addition to the table of the result type.
I would suggest something like the following in org.hibernate.impl.SQLQueryImpl
Code:
/**
* adds a table to be dirty checked and possibly flushed
*/
public SQLQuery addQuerySpace(String space) {
if(querySpaces == null){
querySpaces = new ArrayList();
}
querySpaces.add(space.toUpperCase());
return this;
}
This makes hibernate check for, and flush, the spaces added.
I do not know if this breaks code other places in hibernate, but i do know that it fixes the problem statet by Frank. And it seems to work since i am able to run all my projects test with this addition to hibernate.