Posted by
Andrew Sykes on
Apr 29, 2006; 9:16am
URL: http://ofbiz.116.s1.nabble.com/Dev-findByLike-tp167804p167805.html
Hans,
It looks to me like GenericDelegator.findByLike is calling the wrong
constructor method on EntityExpr. There are 2 similar constructors...
The one we should use is...
EntityExpr(java.lang.String lhs, EntityComparisonOperator operator,
java.lang.Object rhs)
The one that is actually being used is...
EntityExpr(EntityCondition lhs, EntityJoinOperator operator,
EntityCondition rhs)
The reason the wrong one is being called is that by default
Map.Entry.getKey() returns type Object. GenericDelegator.findByLike
should be casting this key to type String.
I've attached a patch below...
Index: /home/andrew/eclipse-
workspace/ofbiz/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
===================================================================
--- /home/andrew/eclipse-
workspace/ofbiz/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (revision 7443)
+++ /home/andrew/eclipse-
workspace/ofbiz/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (working copy)
@@ -1666,7 +1666,7 @@
Iterator fieldEntries = fields.entrySet().iterator();
while (fieldEntries.hasNext()) {
Map.Entry fieldEntry = (Map.Entry) fieldEntries.next();
- likeExpressions.add(new EntityExpr(fieldEntry.getKey(),
EntityOperator.LIKE, fieldEntry.getValue()));
+ likeExpressions.add(new EntityExpr
((String)fieldEntry.getKey(), EntityOperator.LIKE, fieldEntry.getValue
()));
}
}
EntityConditionList ecl = new EntityConditionList
(likeExpressions, EntityOperator.AND);
--
Kind Regards
Andrew Sykes <
[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev