The Order entity has the date attribute as TemporalType.DATE and the localDate attribute as LocalDate.
Case 1:
Create a new report using Wizard.
Entity: Order
Report type: Reports for list of entities, selected by query
In the Define query window add two condition properties for the localDate attribute, e.g. start_date and end_date
The other settings on your choice
Run the report
See report: Order.LocalDate by Wizard
AR:
Parameters have the String type. The type can't be changed due to an exception:
ClassCastException: java.time.LocalDate cannot be cast to java.lang.String
An exception when the report is executed:
An error occurred while loading data for band [Orders] and query [Dataset]. Report name [Order.LocalDate by Wizard]
An error occurred while loading data for data set [Dataset]
You have attempted to set a value of type class java.lang.String for parameter 1 with expected type of class java.time.LocalDate from query string select
customer.name ,
e.amount from sales_Order e
left join e.customer customer
where (e.localDate >= ?1 and e.localDate <= ?2).
Case 2
For the report above
Remove incorrect parameters
Add parameters with the Date type
Run the report
AR:
HSQLDB
An error occurred while loading data for band [Orders] and query [Dataset]. Report name [Order.LocalDate by Wizard]
An error occurred while loading data for data set [Dataset]
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.3.6-cuba): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLDataException: data exception: datetime field overflow
Error Code: -3408
Call: SELECT t0.NAME, t1.AMOUNT FROM SALES_ORDER t1 LEFT OUTER JOIN SALES_CUSTOMER t0 ON (t0.ID = t1.CUSTOMER_ID) WHERE (((t1.LOCAL_DATE >= ?) AND (t1.LOCAL_DATE <= ?)) AND (t1.DELETE_TS IS NULL))
bind => [+4141882-07-11, +4148979-03-07]
Query: ReportQuery(referenceClass=Order sql="SELECT t0.NAME, t1.AMOUNT FROM SALES_ORDER t1 LEFT OUTER JOIN SALES_CUSTOMER t0 ON (t0.ID = t1.CUSTOMER_ID) WHERE (((t1.LOCAL_DATE >= ?) AND (t1.LOCAL_DATE <= ?)) AND (t1.DELETE_TS IS NULL))")
Internal Exception: java.sql.SQLDataException: data exception: datetime field overflow
Error Code: -3408
Call: SELECT t0.NAME, t1.AMOUNT FROM SALES_ORDER t1 LEFT OUTER JOIN SALES_CUSTOMER t0 ON (t0.ID = t1.CUSTOMER_ID) WHERE (((t1.LOCAL_DATE >= ?) AND (t1.LOCAL_DATE <= ?)) AND (t1.DELETE_TS IS NULL))
bind => [+4141882-07-11, +4148979-03-07]
Query: ReportQuery(referenceClass=Order sql="SELECT t0.NAME, t1.AMOUNT FROM SALES_ORDER t1 LEFT OUTER JOIN SALES_CUSTOMER t0 ON (t0.ID = t1.CUSTOMER_ID) WHERE (((t1.LOCAL_DATE >= ?) AND (t1.LOCAL_DATE <= ?)) AND (t1.DELETE_TS IS NULL))")
data exception: datetime field overflow
data exception: datetime field overflow
PostgreSQL
No data is shown
In the log you can see the following:
Finished report [Report for entity "Order"] with parameters [localDate1:Thu Sep 05 00:00:00 SAMT 2019]
Even though we defined a parameter with Date type, a timestamp value is passed.
Environment
Description of the bug or enhancement
sample-sales.zip
The Order entity has the
date
attribute asTemporalType.DATE
and thelocalDate
attribute asLocalDate
.Case 1:
localDate
attribute, e.g.start_date
andend_date
See report: Order.LocalDate by Wizard
AR:
Case 2
For the report above
AR:
HSQLDB
PostgreSQL
No data is shown
In the log you can see the following:
Even though we defined a parameter with Date type, a timestamp value is passed.