|
Michael Watzek made changes - 04/Oct/05 07:50 PM
[
Permlink
| « Hide
]
Michael Watzek added a comment - 05/Oct/05 12:09 AM
The attached patch introduces a new class QueryElementHolder. This class may be used to create a JDO query instance using a single string or using the API methods on javax.jdo.Query. Moreover, the patch introduces compile and execute methods on class Query_Test, taking an instance of QueryElementHolder as parameter.
Michael Watzek made changes - 05/Oct/05 12:09 AM
The second attachment replaces the first. Please review this one instead of the first one.
Michael Watzek made changes - 11/Oct/05 11:31 PM
The second patch contains a file (companyForQueryTests.xml) which is part of patch
The patch looks good, just a few comments:
QueryElementHolder: - I propose to change the constructor arguments specifying the range query element. One constructor could take two long arguments. This will call the Query API method setRange(long, long). The other constructor takes two String arguments. This will call the Query API method setRange(String) and pass a string created from the two string arguments with a comma in between. We cannot use a single range string, because the JDOQL syntax is different for setRange argument and the range specification in the single string case. - The link tag on line 31 misses the closing curly bracket (}). - I think you need to fully qualify the Query class in the link tag: {@link javax.jdo.Query}. - How about adding a javadoc to toString saying that this methods returns the single string JDOQL representation? - The javadoc of method getAPIQuery could say that it calls the Query API methods to specify query elements such as setFilter etc. - How about if method getAPIQuery stores the extent instance in a local variable and then calls pm.newQuery(extent)? QueryTest: - Line 387 has the same comment as line 119. How about moving method getCompanyModelInstances in the first section of company model helper methods? - It is confusing that the private method compile declared on line 487 does not create a single string Query using method getSingleStringQuery provided by QueryElementHolder. The reason is that the implementation checks argument queryElementHolder being null to decide whether to use the Query API or create a single string query. How about adding a boolean flag called useQueryAPI for this? If the queryElementHolder is specified then the new flag determines whether to call getAPIQuery or setSingleStringQuery on the holder. If there is no holder the method takes the argument singleStringQuery to call Query.newQuery directly. - Method execute: would it make sense to add a new method checkUniqueQueryResult to check the expected result of a query with unique=true? I think we need a TCK test case making sure that a query with unique=true does not return a list. I think we can give a better error message if we add the extra method checkUniqueQueryResult. The third patch contains all the comments.
Michael Watzek made changes - 12/Oct/05 02:38 AM
Two minors:
- QueryElementHolder: there is a private method rangeToString to create the range element for a single string query. I propose to add a similar method for a query created using the API methods. - QueryTest: the private methods compile and execute both have flags to determine whether itis a API or singleStringQuery: useAPIQuery and asStringString. How about uiosng the same flag (asStringString) in both cases? From my point of view the patch is ready for check in. Third patch has been checked in.
Michael Watzek made changes - 13/Oct/05 01:33 AM
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||