Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0023538
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajoralways2013-04-12 10:302013-04-30 21:05
ReportermiruritaView Statuspublic 
Assigned Toshankarb 
PriorityhighResolutionno change requiredFixed in Version
StatusclosedFix in branchpiFixed in SCM revision5e5dd4a8b5c0
ProjectionnoneETAnoneTarget Version
OSLinux 32 bitDatabasePostgreSQLJava version1.6.0_18
OS VersionCommunity ApplianceDatabase version8.3.9Ant version1.7.1
Product VersionpiSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0023538: Tab whereclause not resolving properly comparations of YesNo (boolean) reference columns.

Description1) As system admin mark FIN_Payment_Proposal.Isreceipt column as stored in session.
2) As system admin go to "Payment Proposal Pick and Edit Lines" window
 2.1) Edit the "Pick and Edit Lines" tab whereclause
replace e.salesTransaction = false
for
e.salesTransaction = @FIN_Payment_Proposal.receipt@
3) compile
4) Go to Payment Proposal window, create a new record and click on "Select Expected Payments" button

the value sent to the backend is
@FIN_Payment_Proposal.receipt@: false

5) See the error

2483ed25 1794036 [TP-Processor3] ERROR org.openbravo.service.json.DefaultJsonDataService - java.lang.String cannot be cast to java.lang.Boolean
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
    at org.hibernate.type.descriptor.java.BooleanTypeDescriptor.unwrap(BooleanTypeDescriptor.java:36)
    at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$1.doBind(VarcharTypeDescriptor.java:52)
    at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277)
    at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:67)
    at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:571)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1716)
    at org.hibernate.loader.Loader.doQuery(Loader.java:801)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
    at org.hibernate.loader.Loader.doList(Loader.java:2533)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
    at org.hibernate.loader.Loader.list(Loader.java:2271)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    at org.openbravo.dal.service.OBQuery.list(OBQuery.java:115)
Steps To Reproduce1) As system admin mark FIN_Payment_Proposal.Isreceipt column as stored in session.
2) As system admin go to "Payment Proposal Pick and Edit Lines" window
 2.1) Edit the "Pick and Edit Lines" tab whereclause
replace e.salesTransaction = false
for
e.salesTransaction = @FIN_Payment_Proposal.receipt@
3) compile
4) Go to Payment Proposal window, create a new record and click on "Select Expected Payments" button

the value sent to the backend is
@FIN_Payment_Proposal.receipt@: false

5) See the error

2483ed25 1794036 [TP-Processor3] ERROR org.openbravo.service.json.DefaultJsonDataService - java.lang.String cannot be cast to java.lang.Boolean
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
    at org.hibernate.type.descriptor.java.BooleanTypeDescriptor.unwrap(BooleanTypeDescriptor.java:36)
    at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$1.doBind(VarcharTypeDescriptor.java:52)
    at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277)
    at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:67)
    at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:571)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1716)
    at org.hibernate.loader.Loader.doQuery(Loader.java:801)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
    at org.hibernate.loader.Loader.doList(Loader.java:2533)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
    at org.hibernate.loader.Loader.list(Loader.java:2271)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    at org.openbravo.dal.service.OBQuery.list(OBQuery.java:115)
Proposed Solutionthe following workaround works:

e.salesTransaction = (case when @FIN_Payment_Proposal.receipt@='true' then 'Y' else 'N' end)

TagsNo tags attached.
Attached Filesdiff file icon 23538.diff [^] (1,343 bytes) 2013-04-23 10:17 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0058294)
hgbot (developer)
2013-04-28 09:56

Repository: erp/devel/pi
Changeset: 5e5dd4a8b5c000c0f6ae0f1e8469cd7b6c708200
Author: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
Date: Sun Apr 28 12:45:45 2013 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/5e5dd4a8b5c000c0f6ae0f1e8469cd7b6c708200 [^]

Fixes Issue 0023538: Tab whereclause not resolving properly

Tab whereclause now resolves properly comparations of YesNo (boolean) reference columns.Type casted the typedParameter to boolean when substituting the value.

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
---
(0058312)
hudsonbot (developer)
2013-04-29 19:37

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/10fc6569028b [^]

Maturity status: Test
(0058331)
hgbot (developer)
2013-04-30 11:10

Repository: erp/devel/pi
Changeset: c29fbfed2534706ce58c0bd3b2abc038e1f748eb
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Apr 30 11:09:35 2013 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c29fbfed2534706ce58c0bd3b2abc038e1f748eb [^]

backed out changest related to issue 23538

All values for paramters are treated as String, as it is not possible at this
point to determine the type they should be. Converting "true" and "false" literals
to boolean values can fail in case the property they are compared to is not a
boolean.

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
---
(0058332)
alostale (manager)
2013-04-30 11:14

This is not going to be changed.

The proposed fix assumed "true" and "false" literals are always boolean doing the conversion based on that. This causes an API change (if a query uses the workaround explained in the use, it would stop working after the fix).

The problem is at the evaluation point it is not possible to determine for a parameter which is the type it should take and guessing it can cause problems.

In addition, other types are not converted from String. For example in the same query, dates are passed as String and transformed within the query itself.
(0058390)
hudsonbot (developer)
2013-04-30 21:05

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/3ea22ca7a348 [^]

Maturity status: Test

- Issue History
Date Modified Username Field Change
2013-04-12 10:30 mirurita New Issue
2013-04-12 10:30 mirurita Assigned To => AugustoMauch
2013-04-12 10:30 mirurita Modules => Core
2013-04-12 10:30 mirurita Triggers an Emergency Pack => No
2013-04-16 11:59 shankarb Assigned To AugustoMauch => shankarb
2013-04-23 10:17 shankarb File Added: 23538.diff
2013-04-28 08:40 shankarb Issue Monitored: AugustoMauch
2013-04-28 08:40 shankarb Review Assigned To => AugustoMauch
2013-04-28 08:40 shankarb Status new => scheduled
2013-04-28 08:40 shankarb fix_in_branch => pi
2013-04-28 09:56 hgbot Checkin
2013-04-28 09:56 hgbot Note Added: 0058294
2013-04-28 09:56 hgbot Status scheduled => resolved
2013-04-28 09:56 hgbot Resolution open => fixed
2013-04-28 09:56 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/5e5dd4a8b5c000c0f6ae0f1e8469cd7b6c708200 [^]
2013-04-29 19:37 hudsonbot Checkin
2013-04-29 19:37 hudsonbot Note Added: 0058312
2013-04-30 11:10 hgbot Checkin
2013-04-30 11:10 hgbot Note Added: 0058331
2013-04-30 11:10 alostale Status resolved => new
2013-04-30 11:10 alostale Resolution fixed => open
2013-04-30 11:14 alostale Review Assigned To AugustoMauch => alostale
2013-04-30 11:14 alostale Note Added: 0058332
2013-04-30 11:14 alostale Status new => closed
2013-04-30 11:14 alostale Resolution open => no change required
2013-04-30 21:05 hudsonbot Checkin
2013-04-30 21:05 hudsonbot Note Added: 0058390


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker