[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-229?page=co...
]
Ryan Fowler commented on HHH-229:
---------------------------------
I'm having this problem and I get a "PERMISSION VIOLATION" when I click on
the TODO-129. I also don't see a way to attach a file to this issue, so I'm
pasting my patch into this comment. This seems to suite my purposes and the test case
doesn't bomb out anymore but I'm not familiar enough with this code to guarantee
correctness.
Index: src/org/hibernate/cfg/HbmBinder.java
===================================================================
--- src/org/hibernate/cfg/HbmBinder.java (revision 14512)
+++ src/org/hibernate/cfg/HbmBinder.java (working copy)
@@ -2940,6 +2940,15 @@
if ( condition==null) {
throw new MappingException("no filter condition found for
filter: " + name);
}
+ // If this is a many-to-many association, add the filter as many-to-many
+ if(filterable instanceof Collection ) {
+ Collection c = (Collection)filterable;
+ if(!c.isOneToMany()) {
+ log.debug( "Applying ManyToMany filter [" + name +
"] as [" + condition + "]" );
+ c.addManyToManyFilter(name, condition);
+ return;
+ }
+ }
log.debug( "Applying filter [" + name + "] as [" +
condition + "]" );
filterable.addFilter( name, condition );
}
Filter failes on many-to-many relations
---------------------------------------
Key: HHH-229
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-229
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.1 rc3
Environment: Hibernate3 RC1
Reporter: Magnus Sandberg
Attachments: filterexample.zip
When adding a filter to a class or one-to-many relation the filtering happens as
expected. When adding a filter to a many-to-many relation (and I guess other relations
using a join table) the columns in the filter-condition are mapped on the join table and
not the associated table - the result is failure with exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira