|
[
Permlink
| « Hide
]
Daniel Lee added a comment - 10/Aug/07 01:45 AM
The fix for OpenJPA-312.
Daniel,
The basic idea of the patch looks okay, but the code changes do not look consistent. In some cases, you use "sql" and in others, you are using "sql.getSQL()". I would prefer just using "sql". Also, you check for an empty _grouping after you check if the desired group sub-string is already present in the _grouping. This seems backwards. I know it's only being used to determine whether to use a comma or not. So, instead of doing these extra empty checks, could we do something along the following. I think this accomplishes the same goal. getJoins(joins, true); if (_grouping == null) { _grouping = new SQLBuffer(_dict); _grouping.append(sql); } else if (_grouping.getSQL().indexOf(sql) < 0) _grouping.append(", " + sql); Thanks, Kevin Daniel,
The code is much cleaner now. Thanks. But, I don't think the performance of StringTokenizer is worth any advantages it might provide. Is there some reason why the previous mechanism of just using indexOf() wasn't sufficient? I like the idea of isolating this check to a single boolean method like you have, but I would like to see a better performing implementation. Thanks, Kevin Per discussion conclusion, attached here is the patch of fix using a ListArray to keep track of the columns in _grouping. StringTokenizer has been removed.
Thanks, Daniel Daniel, Thanks for the updated patch. Per our side discussion, I am making a couple of slight changes to your patch, but the intent is still there. Thanks for resolving this issue. I will be committing the changes shortly.
Kevin |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||