BAEL-6377: CTE Support in Hibernate#19280
Conversation
| private Employee manager; | ||
|
|
||
| public Long getId() { | ||
|
|
There was a problem hiding this comment.
Remove the extra blank line (same elsewhere)
| with engineers as ( | ||
| select e.id as id | ||
| from Employee e | ||
| where e.department = 'Engineering' | ||
| ) | ||
| select e | ||
| from Employee e | ||
| where e.id in (select id from engineers) | ||
| and e.salary > 100000 | ||
| order by e.name asc | ||
| """, Employee.class).getResultList(); |
There was a problem hiding this comment.
What are your thoughts on using uppercase WITH AS SELECT FROM etc, was it intentional to use lowercase here? The init.sql file does uses the uppercase convention
| order by e.department, e.salary desc | ||
| """, Employee.class).getResultList(); |
There was a problem hiding this comment.
Formatting is a bit different here than in the test below - let's pick a common approach for how to format these """ blocks
| order by e.department, e.name | ||
| """, Employee.class).getResultList(); | ||
|
|
||
| List<String> names = employees.stream().map(Employee::getName).toList(); |
There was a problem hiding this comment.
Formatting - fluent method calls should be split over multiple lines per dot according to the guidelines, as far as I remember
|
|
||
| List<String> names = employees.stream().map(Employee::getName).toList(); | ||
|
|
||
| assertEquals(List.of("David Kim", "Ella Novak", "Grace Lin", "Hugo Alvarez", "Ivy Chen", "Liam Foster"), names); |
There was a problem hiding this comment.
You could also use AssertJ assertThat(..).containsExactly(...)
There was a problem hiding this comment.
AssertJ isn't already part of this module, and it seems a shame to pull it in just for this case, though I can if you want.
There was a problem hiding this comment.
Ok no worries leave as-is then
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class CteUnitTest { |
There was a problem hiding this comment.
How about we expand it to CommonTableExpressionsUnitTest
No description provided.