I managed to reproduced the case where I don't get the simple criteria using your code in the BuiltInDS sample. It really wasn't easy to get this one. It seems to be related to the source of the request.
- Normal clientside requests get the additional criteria from <criteria>.
- New serverside DSRequests picking up the RPCManager from the clientside request get the additional criteria from <criteria>.
- New serverside DSRequests without a RPCManager don't get the additional criteria.
See this modified BuiltInDS:
animals.ds.xml (add)
Code:
<operationBinding operationType="fetch"> <criteria fieldName="lifeSpan" value="20" /> <criteria fieldName="scientificName" value="Ateles panicus" /> </operationBinding>
Code:
<serverObject lookupStyle="new" className="com.smartgwt.sample.server.listener.Employees" />
Code:
package com.smartgwt.sample.server.listener; import com.isomorphic.datasource.DSRequest; import com.isomorphic.datasource.DSResponse; import com.isomorphic.datasource.DataSource; import javax.servlet.http.HttpServletRequest; public class Employees { public DSResponse fetch(DSRequest request, HttpServletRequest servletRequest) throws Exception { // Good DSRequest goodTestRequest = new DSRequest("animals", DataSource.OP_FETCH[B], request.getRPCManager()[/B]); DSResponse goodTestResponse = goodTestRequest.execute(); // Bad DSRequest badTestRequest = new DSRequest("animals", DataSource.OP_FETCH); DSResponse badTestResponse = badTestRequest.execute(); return request.execute(); } };
Log after clicking "Employees" in the browser (relevant rows in bold)
Code:
=== 2014-09-01 16:35:16,374 [4-31] INFO RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0': Moz (Gecko) with Accept-Encoding header === 2014-09-01 16:35:16,385 [4-31] DEBUG IDACall - Header Name:Value pair: Cookie:isc_cState=ready; JSESSIONID=lkuo0nf97cyl1enkbjmv02c1j === 2014-09-01 16:35:16,386 [4-31] DEBUG IDACall - Header Name:Value pair: DNT:1 === 2014-09-01 16:35:16,386 [4-31] DEBUG IDACall - Header Name:Value pair: Host:127.0.0.1:8888 === 2014-09-01 16:35:16,386 [4-31] DEBUG IDACall - Header Name:Value pair: Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 === 2014-09-01 16:35:16,386 [4-31] DEBUG IDACall - Header Name:Value pair: Content-Length:1010 === 2014-09-01 16:35:16,387 [4-31] DEBUG IDACall - Header Name:Value pair: Content-Type:application/x-www-form-urlencoded; charset=UTF-8 === 2014-09-01 16:35:16,387 [4-31] DEBUG IDACall - Header Name:Value pair: Accept-Language:de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 === 2014-09-01 16:35:16,387 [4-31] DEBUG IDACall - Header Name:Value pair: Pragma:no-cache === 2014-09-01 16:35:16,387 [4-31] DEBUG IDACall - Header Name:Value pair: Connection:keep-alive === 2014-09-01 16:35:16,387 [4-31] DEBUG IDACall - Header Name:Value pair: Referer:http://127.0.0.1:8888/BuiltInDS.html?gwt.codesvr=127.0.0.1:9997 === 2014-09-01 16:35:16,387 [4-31] DEBUG IDACall - Header Name:Value pair: User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 === 2014-09-01 16:35:16,388 [4-31] DEBUG IDACall - Header Name:Value pair: Cache-Control:no-cache === 2014-09-01 16:35:16,388 [4-31] DEBUG IDACall - Header Name:Value pair: Accept-Encoding:gzip, deflate === 2014-09-01 16:35:16,388 [4-31] DEBUG IDACall - session exists: lkuo0nf97cyl1enkbjmv02c1j === 2014-09-01 16:35:16,388 [4-31] DEBUG IDACall - remote user: null === 2014-09-01 16:35:16,443 [4-31] DEBUG XML - Parsed XML from (in memory stream): 8ms === 2014-09-01 16:35:16,444 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'transaction' === 2014-09-01 16:35:16,445 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'Object' === 2014-09-01 16:35:16,447 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'List' === 2014-09-01 16:35:16,458 [4-31] DEBUG XML - Parsed XML from C:\Users\me\workspace\lib\smartgwtee-4.1p\samples\built-in-ds\war\builtinds\sc\system\schema\List.ds.xml: 8ms === 2014-09-01 16:35:16,458 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'DataSource' === 2014-09-01 16:35:16,468 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'elem' === 2014-09-01 16:35:16,471 [4-31] DEBUG RPCManager - Processing 1 requests. === 2014-09-01 16:35:16,507 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'employees' === 2014-09-01 16:35:16,507 [4-31] DEBUG DSRequest - Caching instance 23 of DS employees from DSRequest.getDataSource() === 2014-09-01 16:35:16,508 [4-31] DEBUG RPCManager - Request #1 (DSRequest) payload: { criteria:{ }, operationConfig:{ dataSource:"employees", operationType:"fetch", textMatchStyle:"exact" }, startRow:0, endRow:75, componentId:"isc_ListGrid_1", appID:"builtinApplication", operation:"employees_fetch", oldValues:{ } } === 2014-09-01 16:35:16,509 [4-31] INFO IDACall - Performing 1 operation(s) === 2014-09-01 16:35:16,510 [4-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2014-09-01 16:35:16,510 [4-31] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing... === 2014-09-01 16:35:16,535 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'animals' === 2014-09-01 16:35:16,536 [4-31] DEBUG DSRequest - Caching instance 17 of DS animals from DSRequest.getDataSource() === 2014-09-01 16:35:16,536 [4-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2014-09-01 16:35:16,540 [4-36] INFO Download - Returning 304: Not modified on conditional get of: C:\Users\me\workspace\lib\smartgwtee-4.1p\samples\built-in-ds\war\builtinds\sc\skins\Enterprise\images\loadingSmall.gif === 2014-09-01 16:35:16,541 [4-32] INFO Download - Returning 304: Not modified on conditional get of: C:\Users\me\workspace\lib\smartgwtee-4.1p\samples\built-in-ds\war\builtinds\sc\skins\Enterprise\images\pickers\pickers_sprite.png === 2014-09-01 16:35:16,751 [4-31] DEBUG AppBase - [builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application === 2014-09-01 16:35:16,751 [4-31] DEBUG AppBase - [builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation === 2014-09-01 16:35:16,752 [4-31] INFO SQLDataSource - [builtinApplication.null] Performing fetch operation with criteria: [B]{lifeSpan:"20",scientificName:"Ateles panicus"} values: {lifeSpan:"20",scientificName:"Ateles panicus"}[/B] === 2014-09-01 16:35:16,782 [4-31] INFO SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause === 2014-09-01 16:35:16,794 [4-31] INFO SQLDataSource - [builtinApplication.null] 17: Executing SQL query on 'HSQLDB': SELECT animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE (animals.lifeSpan=20 AND LOWER(animals.scientificName)='ateles panicus') === 2014-09-01 16:35:16,899 [4-31] INFO PoolManager - [builtinApplication.null] SmartClient pooling disabled for 'HSQLDB' objects === 2014-09-01 16:35:16,900 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] Initializing SQL config for 'HSQLDB' from system config - using DriverManager: org.hsqldb.jdbcDriver === 2014-09-01 16:35:16,901 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] org.hsqldb.jdbcDriver lookup successful === 2014-09-01 16:35:16,901 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] DriverManager fetching connection for HSQLDB via jdbc url jdbc:hsqldb:hsql://localhost/isomorphic === 2014-09-01 16:35:16,902 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] Passing JDBC URL only to getConnection === 2014-09-01 16:35:17,035 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] makeObject() created an unpooled Connection '2098416250' === 2014-09-01 16:35:17,036 [4-31] DEBUG SQLConnectionManager - [builtinApplication.null] Borrowed connection '2098416250' === 2014-09-01 16:35:17,036 [4-31] DEBUG SQLDriver - [builtinApplication.null] About to execute SQL query in 'HSQLDB' using connection '2098416250' === 2014-09-01 16:35:17,036 [4-31] INFO SQLDriver - [builtinApplication.null] Executing SQL query on 'HSQLDB': SELECT animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE (animals.lifeSpan=20 AND LOWER(animals.scientificName)='ateles panicus') === 2014-09-01 16:35:17,068 [4-31] INFO DSResponse - [builtinApplication.null] DSResponse: List with 1 items === 2014-09-01 16:35:17,069 [4-31] DEBUG ISCKeyedObjectPool - Borrowing object for 'animals' === 2014-09-01 16:35:17,073 [4-31] DEBUG DSRequest - Caching instance 27 of DS animals from DSRequest.getDataSource() === 2014-09-01 16:35:17,074 [4-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2014-09-01 16:35:17,074 [4-31] DEBUG AppBase - [builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application === 2014-09-01 16:35:17,074 [4-31] DEBUG AppBase - [builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation === 2014-09-01 16:35:17,075 [4-31] INFO SQLDataSource - [builtinApplication.null] [B]Performing fetch operation with criteria: {} values: {} [/B]=== 2014-09-01 16:35:17,076 [4-31] INFO SQLWhereClause - [builtinApplication.null] empty condition === 2014-09-01 16:35:17,077 [4-31] INFO SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause === 2014-09-01 16:35:17,078 [4-31] INFO SQLDataSource - [builtinApplication.null] 27: Executing SQL query on 'HSQLDB': SELECT animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE ('1'='1') === 2014-09-01 16:35:17,079 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] DriverManager fetching connection for HSQLDB via jdbc url jdbc:hsqldb:hsql://localhost/isomorphic === 2014-09-01 16:35:17,079 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] Passing JDBC URL only to getConnection === 2014-09-01 16:35:17,181 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] makeObject() created an unpooled Connection '1710796498' === 2014-09-01 16:35:17,182 [4-31] DEBUG SQLConnectionManager - [builtinApplication.null] Borrowed connection '1710796498' === 2014-09-01 16:35:17,182 [4-31] DEBUG SQLDriver - [builtinApplication.null] About to execute SQL query in 'HSQLDB' using connection '1710796498' === 2014-09-01 16:35:17,182 [4-31] INFO SQLDriver - [builtinApplication.null] Executing SQL query on 'HSQLDB': SELECT animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE ('1'='1') === 2014-09-01 16:35:17,196 [4-31] INFO DSResponse - [builtinApplication.null] DSResponse: List with 29 items === 2014-09-01 16:35:17,197 [4-31] DEBUG SQLDriver - Freeing SQLDriver dbConnection 1710796498 === 2014-09-01 16:35:17,198 [4-31] DEBUG SQLConnectionManager - About to close JDBCConnection with hashcode "1710796498" === 2014-09-01 16:35:17,199 [4-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2014-09-01 16:35:17,199 [4-31] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing... === 2014-09-01 16:35:17,199 [4-31] DEBUG AppBase - [builtinApplication.employees_fetch] No userTypes defined, allowing anyone access to all operations for this application === 2014-09-01 16:35:17,199 [4-31] DEBUG AppBase - [builtinApplication.employees_fetch] No public zero-argument method named '_employees_fetch' found, performing generic datasource operation === 2014-09-01 16:35:17,200 [4-31] INFO SQLDataSource - [builtinApplication.employees_fetch] Performing fetch operation with criteria: {} values: {} === 2014-09-01 16:35:17,201 [4-31] INFO SQLWhereClause - [builtinApplication.employees_fetch] empty condition === 2014-09-01 16:35:17,201 [4-31] INFO SQLDataSource - [builtinApplication.employees_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause === 2014-09-01 16:35:17,204 [4-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] Executing row count query: SELECT COUNT(*) FROM $defaultTableClause WHERE $defaultWhereClause === 2014-09-01 16:35:17,205 [4-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] Eval'd row count query: SELECT COUNT(*) FROM employeeTable WHERE ('1'='1') === 2014-09-01 16:35:17,206 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.employees_fetch] DriverManager fetching connection for HSQLDB via jdbc url jdbc:hsqldb:hsql://localhost/isomorphic === 2014-09-01 16:35:17,206 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.employees_fetch] Passing JDBC URL only to getConnection === 2014-09-01 16:35:17,308 [4-31] DEBUG PoolableSQLConnectionFactory - [builtinApplication.employees_fetch] makeObject() created an unpooled Connection '1783124385' === 2014-09-01 16:35:17,308 [4-31] DEBUG SQLConnectionManager - [builtinApplication.employees_fetch] Borrowed connection '1783124385' === 2014-09-01 16:35:17,309 [4-31] DEBUG SQLDriver - [builtinApplication.employees_fetch] About to execute SQL query in 'HSQLDB' using connection '1783124385' === 2014-09-01 16:35:17,309 [4-31] INFO SQLDriver - [builtinApplication.employees_fetch] Executing SQL query on 'HSQLDB': SELECT COUNT(*) FROM employeeTable WHERE ('1'='1') === 2014-09-01 16:35:17,324 [4-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] Using SQL Limit query === 2014-09-01 16:35:17,324 [4-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] SQL windowed select rows 0->75, result size 75. Query: SELECT LIMIT 0 75 employeeTable.userOrder, employeeTable.Name, employeeTable.EmployeeId, employeeTable.ReportsTo, employeeTable.Job, employeeTable.Email, employeeTable.EmployeeType, employeeTable.EmployeeStatus, employeeTable.Salary, employeeTable.OrgUnit, employeeTable.Gender, employeeTable.MaritalStatus FROM employeeTable WHERE ('1'='1') === 2014-09-01 16:35:17,324 [4-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] SQL windowed select rows 0->75, result size 75. Query: SELECT LIMIT 0 75 employeeTable.userOrder, employeeTable.Name, employeeTable.EmployeeId, employeeTable.ReportsTo, employeeTable.Job, employeeTable.Email, employeeTable.EmployeeType, employeeTable.EmployeeStatus, employeeTable.Salary, employeeTable.OrgUnit, employeeTable.Gender, employeeTable.MaritalStatus FROM employeeTable WHERE ('1'='1') === 2014-09-01 16:35:17,354 [4-31] INFO DSResponse - [builtinApplication.employees_fetch] DSResponse: List with 75 items === 2014-09-01 16:35:17,355 [4-31] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8 === 2014-09-01 16:35:17,356 [4-31] DEBUG RPCManager - DMI response, dropExtraFields: true === 2014-09-01 16:35:17,396 [4-31] DEBUG SQLDriver - Freeing SQLDriver dbConnection 1783124385 === 2014-09-01 16:35:17,396 [4-31] DEBUG SQLConnectionManager - About to close JDBCConnection with hashcode "1783124385" === 2014-09-01 16:35:17,397 [4-31] DEBUG SQLDriver - Freeing SQLDriver dbConnection 2098416250 === 2014-09-01 16:35:17,398 [4-31] DEBUG SQLConnectionManager - About to close JDBCConnection with hashcode "2098416250" === 2014-09-01 16:35:17,400 [4-31] INFO Compression - /builtinds/sc/IDACall: 17687 -> 2910 bytes === 2014-09-01 16:35:20,974 [4-36] INFO Download - Returning 304: Not modified on conditional get of: C:\Users\me\workspace\lib\smartgwtee-4.1p\samples\built-in-ds\war\builtinds\sc\skins\Enterprise\images\Scrollbar\vscroll_sprite.png
Thank you & Best regards,
Blama
Leave a comment: