I debugged hibernate code and found that hibernate finally calls EntityLoader.loadByUniqueKey() method:
Expand|Select|Wrap|Line Numbers
- public Object loadByUniqueKey(SessionImplementor session, Object key)
- throws HibernateException {
- return load(session, key, null, null);
- }
and user may not have specified to fetch this associations and hence not enabled corresponding filters on session and also
not provided filter parameters.
For my case it is very important that i always apply filter as in my case if i don't apply filters, it will return me more than one record as i have one-to-one assocition at Domain model level but
same association is one-to-many at database level and by applying filter i make this one-to-many association at database level as
one-to-one association at Domain model.
Is there somehow, i can apply filters always to one-to-one association or better don;t even create a proxy of one-to-one assocaitons that
i have not asked for?