Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029428Openbravo ERPA. Platformpublic2015-03-24 10:012015-07-02 08:52
caristu 
alostale 
immediateminoralways
closedfixed 
5
3.0PR14Q2.6 
3.0PR15Q1.33.0PR15Q1.3 
AugustoMauch
Core
Production - Confirmed Stable
No
0029428: Distinct parameter is not working in JSON REST web services
Distinct parameter is not working in JSON REST web services. An error like the following is thrown when using it:

{"response":{"data":[{"response":{"status":-1,"error":{"message":"Exception when creating query select me from Product as me where ( exists (select 1 from Product inner join null.organization as i where i = me and e.organization.id in ('E443A31992CB4635AFCAEABE7183CE85', '0', 'DC206C91AA6A4897B44DA897936E0EC3', '7BABA5FF80494CAFA54DEBD22EC46F01', 'BAE22373FEBE4CCCA24517E23F0C8A48', '19404EAD144C49A0AF37D54377CF452D', 'B843C30461EA4501935CB1D125C9C25A', '2E60544D37534C0B89E765FE29BC0B43') and e.client.id in ('23C59575B9CF467C9620760EB255B389', '0')) )order by me.name","messageType":"Error","title":""},"totalRows":0}}
1) Do the following web service call

https://livebuilds.openbravo.com/erp_pi_pgsql/org.openbravo.service.json.jsonrest/Product?_distinct=organization [^]

Notice that the error is returned
Approved
blocks defect 0029385 closed alostale Distinct parameter is not working in JSON REST web services 
Issue History
2015-03-26 12:01alostaleTypedefect => backport
2015-03-26 12:01alostaleTarget Version => 3.0PR15Q1.3
2015-03-26 15:38dmitry_mezentsevTag Attached: Approved
2015-04-07 08:01alostaleReview Assigned To => AugustoMauch
2015-04-07 08:28hgbotCheckin
2015-04-07 08:28hgbotNote Added: 0076347
2015-04-07 08:28hgbotStatusscheduled => resolved
2015-04-07 08:28hgbotResolutionopen => fixed
2015-04-07 08:28hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR15Q1.3/rev/b1547740b5a2f3b8bff919777134ff7bf68fa9d2 [^]
2015-04-08 18:30AugustoMauchNote Added: 0076388
2015-04-08 18:30AugustoMauchStatusresolved => closed
2015-04-08 18:30AugustoMauchFixed in Version => 3.0PR15Q1.3
2015-07-02 08:52alostaleAssigned Toplatform => alostale

Notes
(0076347)
hgbot   
2015-04-07 08:28   
Repository: erp/backports/3.0PR15Q1.3
Changeset: b1547740b5a2f3b8bff919777134ff7bf68fa9d2
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Mar 26 15:21:18 2015 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR15Q1.3/rev/b1547740b5a2f3b8bff919777134ff7bf68fa9d2 [^]

fixed bug 29428: Distinct parameter is not working in JSON REST web services

  Using _distinct property in JSON REST webservices resulted in an incorrectly
  generated query. There were 2 problems:

   - Entity name for was set in the fetch method, after the refactor done to fix
     issue 0025182, entity is different in case of using _distinct, and it is managed
     by QueryService.
   - This refactor also requires of using aliases to work

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonRestServlet.java
---
(0076388)
AugustoMauch   
2015-04-08 18:30   
Code reviewed and verified in [1]@eda5123f66b0

[1] https://code.openbravo.com/erp/backports/3.0PR15Q1.3/ [^]