The error:
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field fo.bar.ClassName to java.lang.Long
The solution:
The problem is that the field of the object which is used is an object itself and I did not specifiy the field of the object. Therefore we need to specifiy the field of the object.
Description:
This section in the SQL (excerpt):
pricedata.product IN ( ? , ? , ? ) AND ( pricedata.product_unit IN ( ? , ? , ? )
need to be look like this:
pricedata.product.id IN ( ? , ? , ? ) AND ( pricedata.product_unit.id IN ( ? , ? , ? )
@ManyToOne
@JoinColumn(“product”)
private Product product;
Wrong sql statement:
Select pd from priceData pd where pd.product in (100, 200);
Select pd from priceData pd where pd.product.id in (100, 200);
This entry has saved me a couple of times. Thanks for posting this!