You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2013/12/19 18:26:08 UTC
[jira] [Resolved] (CXF-5449) FIQL parser having a problem with a
JPA entity that contains a list of other entities.
[ https://issues.apache.org/jira/browse/CXF-5449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-5449.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.7.9
3.0.0-milestone2
Assignee: Sergey Beryozkin
> 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
> Assignee: Sergey Beryozkin
> Fix For: 3.0.0-milestone2, 2.7.9
>
>
> 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)