HHH-15442 Add test for issue
This commit is contained in:
parent
69a5cb3136
commit
bc94357d4a
|
@ -159,6 +159,38 @@ public class AnyTest {
|
|||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-15442")
|
||||
public void testHqlCollectionTypeQueryWithParameters(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
List<PropertySet> propertySets = session.createQuery(
|
||||
"select p from PropertySet p where type(p.generalProperties) = :prop ",
|
||||
PropertySet.class )
|
||||
.setParameter( "prop", IntegerProperty.class)
|
||||
.list();
|
||||
assertEquals( 1, propertySets.size() );
|
||||
|
||||
PropertySet propertySet = propertySets.get( 0 );
|
||||
assertEquals( 1, propertySet.getGeneralProperties().size() );
|
||||
|
||||
assertEquals( "age", propertySet.getGeneralProperties().get( 0 ).getName() );
|
||||
|
||||
propertySets = session.createQuery(
|
||||
"select p from PropertySet p where type(p.generalProperties) = :prop ",
|
||||
PropertySet.class )
|
||||
.setParameter( "prop", StringProperty.class)
|
||||
.list();
|
||||
assertEquals( 1, propertySets.size() );
|
||||
|
||||
propertySet = propertySets.get( 0 );
|
||||
assertEquals( 1, propertySet.getGeneralProperties().size() );
|
||||
|
||||
assertEquals( "name", propertySet.getGeneralProperties().get( 0 ).getName() );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-15323")
|
||||
public void testHqlTypeQuery(SessionFactoryScope scope) {
|
||||
|
@ -181,6 +213,33 @@ public class AnyTest {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-15442")
|
||||
public void testHqlTypeQueryWithParameter(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
List<PropertyHolder> propertyHolders = session.createQuery(
|
||||
"select p from PropertyHolder p where type(p.property) = :prop ",
|
||||
PropertyHolder.class )
|
||||
.setParameter( "prop", IntegerProperty.class)
|
||||
.list();
|
||||
assertEquals( 1, propertyHolders.size() );
|
||||
|
||||
assertEquals( "age", propertyHolders.get( 0 ).getProperty().getName() );
|
||||
|
||||
propertyHolders = session.createQuery(
|
||||
"select p from PropertyHolder p where type(p.property) = :prop ",
|
||||
PropertyHolder.class )
|
||||
.setParameter( "prop", StringProperty.class)
|
||||
.list();
|
||||
assertEquals( 1, propertyHolders.size() );
|
||||
|
||||
assertEquals( "name", propertyHolders.get( 0 ).getProperty().getName() );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultAnyAssociation(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
|
|
Loading…
Reference in New Issue