nordborg wrote:
I don't know what is causing the duplicates, but the difference between session.get() and using a HQL query is that session.get() uses the fetching strategy that you have specified in your mapping files/annotations (eg. fetch="join"), but this is ignored when you use HQL. The reason that you are seeing additional select's in the second case is probably that your collections are non-lazy.
Thanks nordborg.
You solved my problem!
Just think it's better to let new Hibernate users know, depending on the mapping, Hibernate will generates different SQL queries which might in turn produce different results. get(class, id) is different from find("from class where id = ?", id).