Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 495F810932 for ; Mon, 9 Dec 2013 20:42:09 +0000 (UTC) Received: (qmail 90349 invoked by uid 500); 9 Dec 2013 20:42:08 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 90307 invoked by uid 500); 9 Dec 2013 20:42:08 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 90233 invoked by uid 99); 9 Dec 2013 20:42:08 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Dec 2013 20:42:08 +0000 Date: Mon, 9 Dec 2013 20:42:08 +0000 (UTC) From: "Yaytay (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-5449) FIQL parser having a problem with a JPA entity that contains a list of other entities. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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 createBeanNameMap() { Map 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 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 createBeanNameMap() { Map 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 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 createBeanNameMap() { > Map 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 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)