HHH-18309 Add test for issue

This commit is contained in:
Marco Belladelli 2024-07-02 16:05:44 +02:00
parent 4da2659292
commit 9ec2dbb620
1 changed files with 19 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.Jira;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
@ -91,6 +92,24 @@ public class NativeQueryLimitOffsetTest {
);
}
@Test
@Jira( "https://hibernate.atlassian.net/browse/HHH-18309" )
public void testLimitOffsetZeroValue(SessionFactoryScope scope) {
scope.inTransaction( session -> {
List<Long> l = session.createNativeQuery( "select id from Person where name like :name", Long.class )
.setParameter( "name", "J%" )
.setFirstResult( 0 )
.getResultList();
assertEquals( 5, l.size() );
l = session.createNativeQuery( "select id from Person where name like :name", Long.class )
.setParameter( "name", "J%" )
.setMaxResults( 0 )
.getResultList();
assertEquals( 0, l.size() );
} );
}
@Entity(name = "Person")
public static class Person {
@Id