Jpa 您已尝试设置类型为class entity的值
我正在使用JPA2与eclipslink 我正在尝试执行此查询: List postEntityList=entityManager.createQuery(“从PostEntity p中选择p,其中p.organizationEntity=?1和p.organizationUnitEntity=?2和p.organizationLocationEntity=?3和p.organizationBatchEntity=?4和p.postCategoryEntity=?5和p.dateOfPosting,按p.rating desc的顺序介于?6和?7之间”)。setParameter(1,organizationEntity)。setParameter(2,organizationUnitEntity).setParameter(3,organizationLocationEntity).setParameter(4,organizationBatchEntity).setParameter(5,postCategoryEntity).setParameter(6,minimumTime).setParameter(7,maximumTime).getResultList() 但我得到了一个错误: 您已尝试为参数5设置class entity.PostCategoryEntity类型的值,该值应为class entity.OrganizationEntity类型。请从查询字符串中选择p,其中p.OrganizationEntity=?1和p.organizationUnitEntity=?2和p.organizationLocationEntity=?3和p.organizationBatchEntity=?4和p.PostCategoryEntity=?第5页和第5页。根据p.评级说明,在第6页和第7页之间下单的日期Jpa 您已尝试设置类型为class entity的值,jpa,eclipselink,Jpa,Eclipselink,我正在使用JPA2与eclipslink 我正在尝试执行此查询: List postEntityList=entityManager.createQuery(“从PostEntity p中选择p,其中p.organizationEntity=?1和p.organizationUnitEntity=?2和p.organizationLocationEntity=?3和p.organizationBatchEntity=?4和p.postCategoryEntity=?5和p.dateOfPosti
为什么会这样!!!有什么想法吗…?参数5的类应该是实体
可能您的parameter5是FK,如果是,您需要使用parameter5.parameter来查找实际变量。如果使用命名参数而不是索引,会怎么样?可能是从0对1开始的问题。我尝试过使用命名参数,但错误仍然是一样的。我使用的是eclipselink 2.2.1