Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.7.7
-
None
-
Only tested on Windows 8.
-
Unknown
Description
I have a JPA entity model that has the following chain of relationships:
Order_JpaImpl {
@OneToMany(mappedBy = "order", fetch = FetchType.EAGER, cascade =
)
List< OrderLine_JpaImpl> orderLines = new LinkedList<>();
}
OrderLine_JpaImpl {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "prdId", nullable = false)
@ForeignKey
@Index
private Product_JpaImpl orderLineItem;
}
Product_JpaImpl {
@ManyToOne( cascade = {}, targetEntity = Show_JpaImpl.class, fetch = FetchType.EAGER )
@JoinColumn( name="shwId", nullable = false )
@ForeignKey
@Index
private Show_JpaImpl show;
}
Show_JpaImpl {
@Column( length = 32, unique = true, nullable = false )
private String shortName;
}
I want to use FIQL to get all the orders that include orderlines that have products from a given show.
So I have a simple search expression: show==AMND
And a mapping:
private static Map<String,String> createBeanNameMap()
That is used by:
SearchCondition<ImplType> searchCondition = searchContext.getCondition(targetClass, getBeanNameMap());
Raises this exception:
Caused by: java.lang.IllegalArgumentException: argument type mismatch; setter parameter type: java.util.List, set value type: uk.co.spudsoft.spiderweborders.model.jpaimpl.OrderLine_JpaImpl
at org.apache.cxf.jaxrs.ext.search.Beanspector.setValue(Beanspector.java:152) ~[cxf-rt-rs-extension-search-2.7.8.jar:2.7.8]
at org.apache.cxf.jaxrs.ext.search.Beanspector.setValue(Beanspector.java:131) ~[cxf-rt-rs-extension-search-2.7.8.jar:2.7.8]
at org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser$Comparison.createTemplate(FiqlParser.java:600) ~[cxf-rt-rs-extension-search-2.7.8.jar:2.7.8]
OrderLines is a list of OrderLine objects, but the template is being created with just one and the setter doesn't know how to handle lists.
I tried adding a setter that takes a single OrderLine, but something got upset when it saw that the getter and setter were of different types.
I /think/ the failure occurs when you have:
1. A parent entity containing a list of children.
2. The children entities contain a single grandchild.
3. The search is for a property of the grandchild.
And it fails when it tries to set the grandchild in the child.
I've actually got another layer in the hierarchy (great-grandchild), but given where the exception comes from I suspect that isn't needed to cause the failure.