julie_yaoy wrote:
I spent several days on the similar problem. When I do something like this:
HDL = "FROM tstDACmain as main join fetch main.externStatic"
List list session.createQuery(HDL);
hibernate generates right sql statement: one sql statment. But after binding all the data, it throws HibernateException: instance... altered.
Right now I am going to try a workaround:
1. remove property-ref mapping, e.g externStatic
2. do something like HDL = "Select tstDACmain as main, ExternStatic es where main.##=es.##"
3. processing the result.
Any better suggestion?
Thanks
To avoid the Hibernate exception try to add the SELECT part of the query. I've seen that many queries written for Hibernate 2.6 without the SELECT part, do not work well with Hibernate 3.
The suggestion you propose do work for INNER join, bu cannot for OUTER join ... so it's not my solution.
By thw way, the query you wrote, works? For what I know, it should not, since you remove the "externStatic" mapping ... it can work it you write the class name of externStatic attribute. I'm I wrong?
Reagards
Alessandro