JPA - java.lang.IllegalArgumentException:托管类型中不存在属性 [productName]

JPA - java.lang.IllegalArgumentException: The attribute [productName] is not present in the managed type

我正在使用条件的多选选择以下列 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: The attribute [productName] is not present in the managed type [EntityTypeImpl@5185929:ProductList [ javaType: class test.entity.ProductList descriptor: RelationalDescriptor(test.entity.ProductList --> [DatabaseTable(PRODUCT_LISTS)]), mappings: 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) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.jersey.spi.container.JavaMethodInvokerFactory.invoke(JavaMethodInvokerFactory.java:60)

这并不是说构造函数中没有 arg ... 它是说 class 中没有具有该名称的属性。