There are two entities: Post and Comment. Post has collection of comments that are selected in subselect query: {{@OneToMany(mappedBy = "post", fetch = FetchType.EAGER, cascade = CascadeType.MERGE)}} {{@Fetch(value = FetchMode.SUBSELECT)}} {{private List<Comment> comments;}} When Post entities are selected by CriteriaQuery with specific 'orderBy' expression that contains params (see fragment below), exception '_SQLException: Parameter index out of range (1 > number of parameters, which is 0)._' is thrown. {{Order order = builder.desc(builder.coalesce(root.get("name"), "default_name"));}} {{query.orderBy(order);}} ORMUnitTestCase: [https://github.com/ hibernate Plutonii /hibernate-test-case-templates/ pull commit / 35 fffdf624ba2bec5ca4db84c27ba942f0aa30ac3c |https://github.com/ hibernate Plutonii /hibernate-test-case-templates/ pull commit / 35 fffdf624ba2bec5ca4db84c27ba942f0aa30ac3c|smart-link ] |
|