PDA

View Full Version : HibernateTemplate Load and Get bugs



jnapier
08-08-2006, 01:43 AM
In the HibernateTemplate class there is a mixup with Load and Get. Load uses the LoadByTypeHibernateCallback internal class which actually makes a call to session.Get() inside of DoInHibernate(). GetByTypeHibernateCallback actually does the inverse and calls session.Load() inside of DoInHibernate.

I noticed that there is a similiar problem with LoadByEntityHibernateCallback.

Mark Pollack
08-08-2006, 11:52 AM
Hi,
Thanks! I fixed the mixup in LoadByTypeHibernateCallback and GetByTypeHibernateCallback

I didn't see the problem you mention regarding LoadByEntityHibernateCallback, i.e.



internal class LoadByEntityHibernateCallback : IHibernateCallback
{
// boiler plate ctor/fields
public object DoInHibernate(ISession session)
{
session.Load(entity, id);
return null;
}
}


looks ok.
Cheers,
Mark

jnapier
08-08-2006, 03:35 PM
Yep, you are right. LoadByEntityHibernateCallback looks ok. My eyes must have been playing tricks on me. Thanks for the bug fix.