Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JPA/Hibernate/Querydsl无法对实体数据类名称顺序进行sql排序_Hibernate_Spring Boot_Querydsl_Pageable - Fatal编程技术网

JPA/Hibernate/Querydsl无法对实体数据类名称顺序进行sql排序

JPA/Hibernate/Querydsl无法对实体数据类名称顺序进行sql排序,hibernate,spring-boot,querydsl,pageable,Hibernate,Spring Boot,Querydsl,Pageable,我请求包含排序条件示例id desc的订单索引可分页 请求url 错误消息 我测试变更@Entityname=otherOrder但不起作用 但另一个实体名称可以分页,排序工作正常 例如卖家、账户、产品 订单类 订单管理员 订单服务 orderRepositoryImpl 变更单->其他名称其他是一种解决方案 有其他解决方案吗?val orders=querydsl!!之后的订单内容是什么!!。applyPaginationpageable,查询。fetch@SimonMartinellival

我请求包含排序条件示例id desc的订单索引可分页

请求url

错误消息

我测试变更@Entityname=otherOrder但不起作用

但另一个实体名称可以分页,排序工作正常 例如卖家、账户、产品

订单类

订单管理员

订单服务

orderRepositoryImpl

变更单->其他名称其他是一种解决方案
有其他解决方案吗?

val orders=querydsl!!之后的订单内容是什么!!。applyPaginationpageable,查询。fetch@SimonMartinellival orders被列出后,并且里面有数据?@SimonMartinelli inside返回示例列表顺序{id=1 merchantUid=helloworld}
/orders?page=0&size=20&sort=id,desc
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'order.id' [select order1
from com.mystore.domain.Order order1
order by order.id desc]; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'order.id' [select order1
from com.mystore.domain.Order order1
order by order.id desc]] with root cause

org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'order.id' [select order1
from com.mystore.domain.Order order1
@Entity
@Table(name="orders")
data class Order(
        @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
        val id: Long = 0,
        @Column(unique = true)
        val merchantUid: String) {}
@GetMapping
@ApiPageable
fun index(searchOrder: SearchOrder, pageable: Pageable): Page<Any> {
    return orderService.findAllWithSearchAndPageable(searchOrder, pageable)
}
fun findAllWithSearchAndPageable(searchOrder: SearchOrder, pageable: Pageable): Page<Any> {
    return orderRepository.findAllWithSearchAndPageable(searchOrder, pageable)
}
@Autowired
lateinit var jpaQueryFactory: JPAQueryFactory

fun findAllWithSearchAndPageable(serarchOrder: SearchOrder, pageable: Pageable): PageImpl<Any> {
    val query = jpaQueryFactory.select(order)
            .from(order)
    val orders = querydsl!!.applyPagination(pageable, query).fetch()

    return PageImpl(orders as List<Any>, pageable, query.fetchCount())
}