|
9 | 9 | import java.util.List;
|
10 | 10 |
|
11 | 11 | import org.hibernate.testing.orm.junit.DomainModel;
|
| 12 | +import org.hibernate.testing.orm.junit.Jira; |
12 | 13 | import org.hibernate.testing.orm.junit.SessionFactory;
|
13 | 14 | import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
14 | 15 | import org.junit.jupiter.api.AfterAll;
|
|
29 | 30 | @DomainModel( annotatedClasses = {
|
30 | 31 | LeftJoinNullnessPredicateQueryTest.Author.class,
|
31 | 32 | LeftJoinNullnessPredicateQueryTest.Book.class
|
32 |
| -} ) |
| 33 | +}) |
| 34 | +@Jira( "https://hibernate.atlassian.net/browse/HHH-16505" ) |
| 35 | +@Jira( "https://hibernate.atlassian.net/browse/HHH-17379" ) |
| 36 | +@Jira( "https://hibernate.atlassian.net/browse/HHH-17397" ) |
| 37 | +@Jira( "https://hibernate.atlassian.net/browse/HHH-19116" ) |
33 | 38 | public class LeftJoinNullnessPredicateQueryTest {
|
34 | 39 | @BeforeAll
|
35 | 40 | public void setUp(SessionFactoryScope scope) {
|
@@ -80,6 +85,19 @@ public void testIsNotNull(SessionFactoryScope scope) {
|
80 | 85 | } );
|
81 | 86 | }
|
82 | 87 |
|
| 88 | + @Test |
| 89 | + public void testIsNullImplicit(SessionFactoryScope scope) { |
| 90 | + scope.inTransaction( session -> { |
| 91 | + final List<Book> resultList = session.createQuery( |
| 92 | + "select book from Book book " + |
| 93 | + "where book.author is null", |
| 94 | + Book.class |
| 95 | + ).getResultList(); |
| 96 | + assertThat( resultList ).hasSize( 1 ); |
| 97 | + assertThat( resultList.get( 0 ).getTitle() ).isEqualTo( "Unknown Author" ); |
| 98 | + } ); |
| 99 | + } |
| 100 | + |
83 | 101 | @Test
|
84 | 102 | public void testDereferenceIsNull(SessionFactoryScope scope) {
|
85 | 103 | scope.inTransaction( session -> {
|
@@ -108,6 +126,19 @@ public void testDereferenceIsNotNull(SessionFactoryScope scope) {
|
108 | 126 | } );
|
109 | 127 | }
|
110 | 128 |
|
| 129 | + @Test |
| 130 | + public void testFkImplicitIsNull(SessionFactoryScope scope) { |
| 131 | + scope.inTransaction( session -> { |
| 132 | + final List<Book> resultList = session.createQuery( |
| 133 | + "select book from Book book " + |
| 134 | + "where fk(book.author) is null", |
| 135 | + Book.class |
| 136 | + ).getResultList(); |
| 137 | + assertThat( resultList ).hasSize( 1 ); |
| 138 | + assertThat( resultList.get( 0 ).getTitle() ).isEqualTo( "Unknown Author" ); |
| 139 | + } ); |
| 140 | + } |
| 141 | + |
111 | 142 | @Test
|
112 | 143 | public void testIsNotNullWithCondition(SessionFactoryScope scope) {
|
113 | 144 | scope.inTransaction( session -> {
|
|
0 commit comments