Hello,

when using <any> mappings it's quite likely that you get ObjectNotFoundExceptions, as it's impossible to use on-delete cascades in such a scenario. Unlike other relation mappings, <any> currently does not support the not-found="ignore" setting.

The only work-around I came up with so far is to use a custom Type that extends AnyType and calls session.internalLoad(entityName, id, false, *true* ) instead of session.internalLoad(entityName, id, false, *false* ).

I have no idea how many people actually use the <any> mapping feature. While it might look like a bad design decision at the first glance, there are indeed some valid use-cases for such a mapping (like the audit log example quoted in the documentation). For none of the possible applications that come into my mind, the default behavior of throwing an ObjectNotFoundException really makes much sense. So I wonder whether it would be feasible to always use nullable=true in AnyType.java?

If this isn't an option, I'd like to vote for adding a not-found="ignore|exception" setting :-)

Best regards,
-Felix

_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to