While fetching one-to-one association, filters are not applied.
I have modified the hibernate code to resolve this issue. With these changes, if filters a are enabled for one-to-one associations,
they will be applied (appear in sql) else not.
Changes Done:
A) In EntityJoinWalker.java >> constructor:line 40
Current Code:
StringBuffer whereCondition = whereString( getAlias(), uniqueKey, batchSize )
//include the discriminator and class-level where, but not filters
.append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) );
Changed Code:
StringBuffer whereCondition = whereString( getAlias(), uniqueKey, batchSize );
//include the discriminator and class-level where, but not filters
String filter= persister.filterFragment( getAlias(), enabledFilters);
whereCondition.insert( 0, StringHelper.moveAndToBeginning(filter) );
Hibernate 3.2.6
also filters cannot be applied to many-to-one, you are mistaken
Steve,
Assuming our intention is not change in cardinality... The intention is to apply only some conditions (filters) to one-to-one.
What problem do you see in this? Also presently hibernate doesn;t have any way to solve this problem.
Can you please let us know a reason why conditions (filters) can't be applied to one-to-one but can be applied to one-to-many ?
Steve,
Can you please answer my query.. i think this feature is required in hibernate.
Sandeep, please stop. This is getting annoying. I have already answered this on your many private emails in addition to here. I am sorry you do not like the answer. This is not something I will implement. And this is really the last I will respond to it.
Steve,
Firstly i am sorry if my questions have troubled you.. My intention was just to help hibernate to improve. Regarding our previous communications, you have replied regarding changing cardinality but you have not yet replied to this query. It's fine with me if you don't want to reply but it would be great if you can redirect me to someone else from hibernate team with whom i can discuss this point in more detail as till today this question is open for me.