[EMAIL PROTECTED] wrote:
Many users have asked for
session.delete("from Foo foo where foo.count=0");
to issue a single SQL DELETE. This is certainly not possible for objects with collections or cascades (though it might not matter if we ignore Lifecycle callback; not sure). For other classes it is conceptually possible.
Now, this is really quite easy to implement - it would take me about 1-2 hours to do it.
But my big problem is: how do we know which _loaded_ objects were deleted? I don't think there is any good way to do this. All we get back from DELETE is a row count.
* Do we issue a SELECT beforehand, to fetch the ids ..... and then issue the delete? * Do we just disable mass delete for classes which have loaded instances? * Is it simply not worth it?
The select-then-delete option doesn't seem particularly better than the current situation when JDBC batch updates are enabled. The disable-when-instances-are-loaded option looks like it would work, but only for some very limited usecases (though it may work for the usecases we are most interested in).
Thoughts?
I would go for the disable-when-instances-are-loaded option.
And we should need some small support methods like: "isMassDeletable(Class c)" or "isMassDeletable(String hql), something to be able to query on the state to find possible answers to why my delete("from People f where f.location = 'Earth') takes a billion years instead of just a couple of seconds ;)
Btw. how would joins fit into this scenario ? Is any/all HQL query deletable ? Can one find out upfront without issuing the delete ?
/max
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel