[
https://issues.apache.org/jira/browse/CXF-5449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yaytay updated CXF-5449:
------------------------
Description:
I have a JPA entity model that has the following chain of relationships:
Order_JpaImpl {
@OneToMany(mappedBy = "order", fetch = FetchType.EAGER, cascade =
{CascadeType.ALL})
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() {
Map<String,String> map = new HashMap<>();
map.put("customerdisplay","customerDisplay");
map.put("ordertime","orderTime");
map.put("fulfilmentstatus","fulfilmentStatus");
map.put("show","orderLines.orderLineItem.show.shortName");
return map;
}
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.
was:
I have a JPA entity model that has the following chain of relationships:
Order_JpaImpl {
@OneToMany(mappedBy = "order", fetch = FetchType.EAGER, cascade =
{CascadeType.ALL})
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() {
Map<String,String> map = new HashMap<>();
map.put("customerdisplay","customerDisplay");
map.put("ordertime","orderTime");
map.put("fulfilmentstatus","fulfilmentStatus");
map.put("show","orderLines.orderLineItem.show.shortName");
return map;
}
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.
> FIQL parser having a problem with a JPA entity that contains a list of other
> entities.
> --------------------------------------------------------------------------------------
>
> Key: CXF-5449
> URL: https://issues.apache.org/jira/browse/CXF-5449
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.7.7
> Environment: Only tested on Windows 8.
> Reporter: Yaytay
>
> I have a JPA entity model that has the following chain of relationships:
> Order_JpaImpl {
> @OneToMany(mappedBy = "order", fetch = FetchType.EAGER, cascade =
> {CascadeType.ALL})
> 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() {
> Map<String,String> map = new HashMap<>();
> map.put("customerdisplay","customerDisplay");
> map.put("ordertime","orderTime");
> map.put("fulfilmentstatus","fulfilmentStatus");
> map.put("show","orderLines.orderLineItem.show.shortName");
> return map;
> }
> 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.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)