Forum Stats

  • 3,836,836 Users
  • 2,262,198 Discussions
  • 7,900,127 Comments

Discussions

BigDecimal type with DefaultBigDecimalFormatter not working in table QBE

Robert Šajina
Robert Šajina Member Posts: 94
edited Oct 20, 2017 8:57AM in JDeveloper and ADF

Hi,

I have a problem with table filter with search fields that are BigDecimal and are using DefaultBigDecimalFormatter.

The problem occurs when i set locale to non-english, that is to Croatian. In my language decimal separator is comma(",").

I have printed the bind values in bindParametersForCollection method in ViewObject and discovered that for input value 7,44  in QBE, i am getting value 744 as the final value.

After searching a little bit more i found out that it is because framework is creating a new VariableImpl object that gets the value form associated viewCriteriaItem.

Value that viewCriteriaItem return is already formatted and the value is for example 7.44.

Now the framework try's to format this value again with the same locale (Croatian) and than the number formatter returns the number 744.

And that is the final value that gets into the query.

Is this a known bug?
Any solutions to this?

JDeveloper: 12.2.1.2.0.0

Robert

Tagged:

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,552 Red Diamond
    edited Oct 16, 2017 12:00PM

    This looks like a bug. However, the only way to know is to file a SR with support.oracle.com (payable support contract needed).

    Have you tried another formatter?

    Or created your own as a workaround?

    Timo

  • Robert Šajina
    Robert Šajina Member Posts: 94
    edited Oct 16, 2017 1:07PM

    Hi Timo,

    thank you for your reply.

    I didn't try other converters but i thought that converter may be the problem. Now that you are asking the same question i will try it tomorrow.

    My workaround is to override method getCriteriaAdapter() in ViewObjectImpl for which is stated next:

       /**    * Return a custom CriteriaAdapter implementation to generate where clause    * for ViewCriteria. The default implementation here returns null, and leave    * it to the ViewCriteriaManager implementation class to determine which    * CriteriaAdapter class to use.    * Subclasses can override this method to provide a custom CriteriaAdapter    * implementation.    *     * @return Custom CriteriaAdapter implementation if desired, or null.    */

    So i made a new class that extends OracleSQLBuilderImpl class.

    I have overridden the method  createTemporaryBindVar(ViewCriteria,ViewCriteriaItem,index).

    There i checked if the ViewCriteriaItem .getJavaType() equals  BigDecimal.class and if so i just kept the value without calling the standard formatting.

    Robert

  • Robert Šajina
    Robert Šajina Member Posts: 94
    edited Oct 18, 2017 8:20AM

    So i have tried Number and Currency converter and have the same issue

    It is a bug in framework, nothing related to converters.

    Robert

  • Robert Šajina
    Robert Šajina Member Posts: 94
    edited Oct 20, 2017 8:57AM

    After applying this implementation i have another problem

    We are setting NLS parameters to the session because of the sort issue, so now if the nls parameters are set to CROATIAN/CROATIA the db now expects number in with comma (",") as a decimal separator.

    Since the framework doesn't convert it to croatian locale i m getting invalid number exception. ( value sent to db has dot as a decimal separator)

    If i replace dot with a comma in my custom implementation than i m getting number parse exception because it is trying to instantiate a BigDecimal object with comma as a  decimal separator.

    Any thoughts on this?

    Robert  

This discussion has been closed.