If you delete records from your database, nothing above the database
will know those records were deleted. This is a really bad thing to be
doing to your application, regardless of your caching layer of choice.
> I ask because I seem to be getting some unexpected errors when I
> delete entities this way. After restarting the cache and servers these
> errors disappear..
You should definitely expect errors if you pull the rug out from under
your application :)
-Ray
Wait! Check that!
I shouldn't reply so quickly to technical emails immediately after
rolling out of bed :P
I didn't read closely and didn't look at the sample there, I thought
you meant you were deleting out of the database with SQL.
I'm really not sure what effect HQL deletes will have off the top of
my head. What sort of errors are you getting?
Again, you should totally ignore the nonsense in my first email.
Unfortunately I don't know the answer to your problem off the top of
my head. Which means you'll have to research this one yourself. It
would be awesome if you posted your findings back for the benefits of
others that may come across the same problem.
My only real theory is that Hibernate cannot guarantee consistency in
the cache when doing HQL deletes like that because it doesn't know
what objects are cached and will be deleted by the query. Perhaps try
not doing deletes like that and instead query up the objects and then
use session.delete on them.