我使用多选标准API
选择以下列代码段
criteriaQuery.multiselect(root.get(MasterCat_.prodId),
joinProduct.get(ProductList_.prName).alias("productName"));
criteriaQuery.orderBy(criteriaBuilder.desc
(root.get(mywrapperclass.getOrderBy()));
按照代码段的上述顺序,我从客户端传递productName
。
在构造函数表达式中我有
public ProductListUtil(Long logId, String productName) {
this.logId = logId;
productName = productName;
}
我得到的错误是java.lang.IllegalArgumentException: The attribute [productName] is not present in the managed type
。
我该如何解决这个问题?
异常堆栈跟踪
java.lang.IllegalArgumentException:托管类型中不存在属性[productName] [EntityTypeImpl @ 5185929:ProductList [javaType:class test.entity.ProductList descriptor:RelationalDescriptor(test.entity.ProductList - > [ DatabaseTable(PRODUCT_LISTS)]),映射:8]]。 at org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl.getAttribute(ManagedTypeImpl.java:148) at org.eclipse.persistence.internal.jpa.querydef.FromImpl.get(FromImpl.java:312) at test.service.ProductListService.getProductListsList(ProductListService.java:129) at test.service.ProductListService.getProductLists(ProductListService.java:101) at test.service.ProductListService.getProductLists(ProductListService.java:94) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在java.lang.reflect.Method.invoke(Method.java:597) at com.sun.jersey.spi.container.JavaMethodInvokerFactory $ 1.invoke(JavaMethodInvokerFactory.java:60)
答案 0 :(得分:1)
并不是说构造函数中没有arg ......它说类中没有带有该名称的属性。