You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Yaytay (JIRA)" <ji...@apache.org> on 2013/12/09 21:36:12 UTC

[jira] [Created] (CXF-5449) FIQL parser having a problem with a JPA entity that contains a list of other entities.

Yaytay created CXF-5449:
---------------------------

             Summary: 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.





--
This message was sent by Atlassian JIRA
(v6.1.4#6159)