Interesting, we just started talking about this very same issue :)
Right now, no, Hibernate does not understand that underlying database objects may have altered rows upon DML operations. But really, do have Hibernate "understand" this (in the way I think you mean understand) would be suboptimal, as it would mean that Hibernate would need to immediately re-read any rows involved in DML operations. Not gonna happen. Where this really gets messy is when mapping an association with cascading deletes and enabling CASCADE triggers in the database.
However, user code can perform like functionality by either 1) evicting the entity from the session and re-reading it, or 2) refreshing the entity.
Quote:
I would think that at least the optimistic locking versioning gets screwed with db-side on delete update, as this does not update version numbers?
Well the versions are still the same in the database as it is in the java memory space. So if by "screwed up" you mean Hibernate will let you continue with operations against that entity, then yes that is correct. But how can this be any different? Optimistic locking, by def, is an application concern to manage (Hibernate simply provides some powerful help wrt this). Think about hand-coding an optimistic locking strategy using JDBC; how would you handle it? Again, the safest way is to re-read rows after DML, which is extremely inefficient.
Quote:
How well does Hibernate coexist with database-side "data-altering" foreign key constraints, say, an on delete cascade
Cascading deletes is the only such "data-altering" FK constraint I am aware of. Did you have others in mind? Currently, if an association is defined in the database with a cascading delete trigger I would not map this in Hibernate using any of the delete cascade values.