Support not-found="ignore" for <any> mappings

Description

It would be useful if the <any> element would support the not-found="ignore|exception" setting. Due to the nature of any-mappings it's impossible to use on-delete cascades at the database layer, so it's very likely that ObjectNotFoundExceptions occur.

Currently the only work-around to gracefully handle such situations seems to be the implementation of a custom EntityNotFoundDelegate that doesn't throw an exception.

Environment

None

Activity

Show:
Felix Gnass
September 10, 2008, 7:19 PM

BTW: Even a custom EntityNotFoundDelegate doesn't help as this leads to a NullPointerException somewhere in Hibernate. So this renders any-mappings pretty much useless in most situations.

Felix Gnass
September 10, 2008, 8:28 PM

A feasible (though not very elegant) solution 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 wonder if it would be a good idea to make this the default behavior of AnyType.java for the reasons stated in the issue's description above.

Comments anyone?

Daniel A Hopper
June 21, 2010, 8:08 PM

I agree, this option should be available.

Assignee

Unassigned

Reporter

Felix Gnass

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure