Skip to content

Commit a936c6e

Browse files
committed
HHH-19189 - Remove LGPL-only contributions - Batch 11
745be88
1 parent 95c5047 commit a936c6e

File tree

2 files changed

+19
-201
lines changed

2 files changed

+19
-201
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/QueryParametersValidationArrayTest.java

Lines changed: 0 additions & 191 deletions
This file was deleted.

hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/QueryParametersValidationTest.java

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
package org.hibernate.orm.test.query.hql;
66

77
import jakarta.persistence.Entity;
8-
import jakarta.persistence.GeneratedValue;
9-
import jakarta.persistence.GenerationType;
108
import jakarta.persistence.Id;
119

10+
import org.hibernate.testing.orm.domain.gambit.SimpleEntity;
1211
import org.hibernate.testing.orm.junit.JiraKey;
1312
import org.hibernate.testing.orm.junit.DomainModel;
1413
import org.hibernate.testing.orm.junit.SessionFactory;
@@ -18,24 +17,34 @@
1817
/**
1918
* @author Andrea Boriero
2019
*/
20+
@SuppressWarnings("JUnitMalformedDeclaration")
2121
@JiraKey( value = "HHH-11397")
22-
@DomainModel( annotatedClasses = QueryParametersValidationTest.TestEntity.class )
22+
@DomainModel( annotatedClasses = {SimpleEntity.class, QueryParametersValidationTest.EntityWithBasicArray.class} )
2323
@SessionFactory( exportSchema = false )
2424
public class QueryParametersValidationTest {
2525
@Test
26-
public void setParameterWithWrongTypeShouldNotThrowIllegalArgumentException(SessionFactoryScope scope) {
27-
scope.inTransaction(
28-
(session) -> session.createQuery( "select e from TestEntity e where e.id = :id" )
29-
.setParameter( "id", 1 )
26+
public void testSetParameterWithWrongType(SessionFactoryScope scope) {
27+
// SimpleEntity#id is of type Integer
28+
scope.inTransaction( (session) ->
29+
session.createQuery( "from SimpleEntity e where e.id = :p" )
30+
.setParameter( "p", 1L )
3031
);
3132
}
3233

33-
@Entity(name = "TestEntity")
34-
public class TestEntity {
34+
@Test
35+
public void testSetParameterWithArrayWithNullElement(SessionFactoryScope scope) {
36+
// SimpleEntity#id is of type Integer
37+
scope.inTransaction( (session) ->
38+
session.createQuery( "from EntityWithBasicArray e where e.strings = :p" )
39+
.setParameter( "p", new String[]{null, "something"} )
40+
);
41+
}
3542

43+
@Entity(name = "EntityWithBasicArray")
44+
public static class EntityWithBasicArray {
3645
@Id
37-
@GeneratedValue(strategy = GenerationType.AUTO)
3846
private Long id;
3947
private String name;
48+
private String[] strings;
4049
}
4150
}

0 commit comments

Comments
 (0)