I was blogging last year about new type configuration in ADF 11g R2 and issue with BigDecimal - ADF BC 11g R2 - Java Extended For Oracle Data Type Map. There is another bug related to Java Extended For Oracle Data Type Map - reproduced with Bind Variable defined from View Criteria for Timestamp type (JDeveloper 11g R2 generates different Timestamp in EO and for Bind Variable in VO).
Download fixed sample application - SearchDateApp.zip. This sample contains View Criteria with Date field (based on Timestamp type generated in EO). View Criteria renders out of the box ADF Query:
You can search by Date:
After the first search, click on calendar icon again. You will get error: java.lang.IllegalArgumentException: Cannot convert date of type java.sql.Timestamp to class oracle.jbo.domain.Timestamp:
Let's understand why this error happens - it can be very frustrating to developers and disappointing as well. Stay cool, try to debug it - compare generated Timestamp type in EO and VO Bind Variable.
Open EO and select HireDate attribute:
Open source XML and check generated type for HireDate. You will see that JDeveloper generates automatically oracle.jbo.domain.Timestamp:
Check what type was auto-generated for Bind Variable in VO (should be also Timestamp):
Open source XML - you will see java.sql.Timestamp was generated for Bind Variable:
There is no way to change this through the wizard, only possible through source XML view. This is what we call - JDeveloper magic, powered by artificial intelligence :) Obviously on runtime we get error, because generated types doesn't match.
Set Bind Variable to match type auto-generated in EO for date attribute - oracle.jbo.domain.Timestamp:
After this change, ADF Query will work without issues (at least related to described problem).
Download fixed sample application - SearchDateApp.zip. This sample contains View Criteria with Date field (based on Timestamp type generated in EO). View Criteria renders out of the box ADF Query:
You can search by Date:
After the first search, click on calendar icon again. You will get error: java.lang.IllegalArgumentException: Cannot convert date of type java.sql.Timestamp to class oracle.jbo.domain.Timestamp:
Let's understand why this error happens - it can be very frustrating to developers and disappointing as well. Stay cool, try to debug it - compare generated Timestamp type in EO and VO Bind Variable.
Open EO and select HireDate attribute:
Open source XML and check generated type for HireDate. You will see that JDeveloper generates automatically oracle.jbo.domain.Timestamp:
Check what type was auto-generated for Bind Variable in VO (should be also Timestamp):
Open source XML - you will see java.sql.Timestamp was generated for Bind Variable:
There is no way to change this through the wizard, only possible through source XML view. This is what we call - JDeveloper magic, powered by artificial intelligence :) Obviously on runtime we get error, because generated types doesn't match.
Set Bind Variable to match type auto-generated in EO for date attribute - oracle.jbo.domain.Timestamp:
After this change, ADF Query will work without issues (at least related to described problem).