HHH-12290 - Fix tests

This commit is contained in:
Andrea Boriero 2018-03-16 17:02:55 +00:00
parent 1ac6218f5d
commit b0cd713ac7
3 changed files with 18 additions and 8 deletions

View File

@ -16,6 +16,7 @@
</id>
<discriminator column="`TYPE`" />
<property name="name" type="string"/>
<property name="surname" type="string"/>
<many-to-one name="other" class="MyEntity" />
<subclass name="MySubclassEntity" discriminator-value="S">
<property name="someSubProperty"/>

View File

@ -15,6 +15,7 @@ package org.hibernate.test.jpa;
public class MyEntity {
private Long id;
private String name;
private String surname;
private MyEntity other;
public Long getId() {
@ -33,6 +34,14 @@ public class MyEntity {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public MyEntity getOther() {
return other;
}

View File

@ -116,10 +116,10 @@ public class JPAQLComplianceTest extends AbstractJPATest {
TransactionUtil2.inTransaction(
sessionFactory(),
session -> {
Query q = session.createQuery( "select item from Item item where item.id in (:values) or item.name in (:values)" );
List<Long> params = new ArrayList<>();
params.add( 0L );
params.add( 1L );
Query q = session.createQuery( "select e from MyEntity e where e.surname in (:values) or e.name in (:values)" );
List<String> params = new ArrayList<>();
params.add( "name" );
params.add( "other" );
q.setParameter( "values", params );
q.list();
}
@ -132,10 +132,10 @@ public class JPAQLComplianceTest extends AbstractJPATest {
TransactionUtil2.inTransaction(
sessionFactory(),
session -> {
Query q = session.createQuery( "select item from Item item where item.id in (?1) or item.name in (?1)" );
List<Long> params = new ArrayList<>();
params.add( 0L );
params.add( 1L );
Query q = session.createQuery( "select e from MyEntity e where e.name in (?1) or e.surname in (?1)" );
List<String> params = new ArrayList<>();
params.add( "name" );
params.add( "other" );
q.setParameter( 1, params );
q.list();
}