HHH-5946 - Tests for not equals operations expecting QuerySyntaxException require dialect does not support row value constructor syntax
This commit is contained in:
parent
765c7020eb
commit
f9065daba1
|
@ -18,6 +18,9 @@ import org.hibernate.dialect.DB2Dialect;
|
|||
import org.hibernate.dialect.HSQLDialect;
|
||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||
import org.hibernate.hql.internal.ast.QuerySyntaxException;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.SkipForDialects;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
@ -221,16 +224,17 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase {
|
|||
*/
|
||||
@Test( expected = QuerySyntaxException.class )
|
||||
@TestForIssue( jiraKey = "HHH-5946" )
|
||||
@RequiresDialectFeature( value = DialectChecks.DoesNotSupportRowValueConstructorSyntax.class )
|
||||
public void testLessThanOperator() {
|
||||
final Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
|
||||
final Query q = s.createQuery( "from Transaction where value < :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "EUR" ) ) );
|
||||
q.list();
|
||||
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
try {
|
||||
final Query q = s.createQuery( "from Transaction where value < :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "EUR" ) ) );
|
||||
q.list();
|
||||
}
|
||||
finally {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,16 +243,17 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase {
|
|||
*/
|
||||
@Test( expected = QuerySyntaxException.class )
|
||||
@TestForIssue( jiraKey = "HHH-5946" )
|
||||
@RequiresDialectFeature( value = DialectChecks.DoesNotSupportRowValueConstructorSyntax.class )
|
||||
public void testLessOrEqualOperator() {
|
||||
final Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
|
||||
final Query q = s.createQuery( "from Transaction where value <= :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "USD" ) ) );
|
||||
q.list();
|
||||
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
try {
|
||||
final Query q = s.createQuery( "from Transaction where value <= :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "USD" ) ) );
|
||||
q.list();
|
||||
}
|
||||
finally {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,16 +262,17 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase {
|
|||
*/
|
||||
@Test( expected = QuerySyntaxException.class )
|
||||
@TestForIssue( jiraKey = "HHH-5946" )
|
||||
@RequiresDialectFeature( value = DialectChecks.DoesNotSupportRowValueConstructorSyntax.class )
|
||||
public void testGreaterThanOperator() {
|
||||
final Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
|
||||
final Query q = s.createQuery( "from Transaction where value > :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "EUR" ) ) );
|
||||
q.list();
|
||||
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
try {
|
||||
final Query q = s.createQuery( "from Transaction where value > :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "EUR" ) ) );
|
||||
q.list();
|
||||
}
|
||||
finally {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,16 +281,17 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase {
|
|||
*/
|
||||
@Test( expected = QuerySyntaxException.class )
|
||||
@TestForIssue( jiraKey = "HHH-5946" )
|
||||
@RequiresDialectFeature( value = DialectChecks.DoesNotSupportRowValueConstructorSyntax.class )
|
||||
public void testGreaterOrEqualOperator() {
|
||||
final Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
|
||||
final Query q = s.createQuery( "from Transaction where value >= :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "USD" ) ) );
|
||||
q.list();
|
||||
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
try {
|
||||
final Query q = s.createQuery( "from Transaction where value >= :amount" );
|
||||
q.setParameter( "amount", new MonetoryAmount( BigDecimal.ZERO, Currency.getInstance( "USD" ) ) );
|
||||
q.list();
|
||||
}
|
||||
finally {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
<column name="currency" not-null="true"/>
|
||||
</property>
|
||||
<property name="timestamp" type="userDateTime">
|
||||
<column name="year"/>
|
||||
<column name="month"/>
|
||||
<column name="day"/>
|
||||
<column name="hour"/>
|
||||
<column name="minute"/>
|
||||
<column name="second"/>
|
||||
<column name="ts_year"/>
|
||||
<column name="ts_month"/>
|
||||
<column name="ts_day"/>
|
||||
<column name="ts_hour"/>
|
||||
<column name="ts_minute"/>
|
||||
<column name="ts_second"/>
|
||||
</property>
|
||||
</class>
|
||||
|
||||
|
|
|
@ -177,4 +177,10 @@ abstract public class DialectChecks {
|
|||
return dialect.canCreateCatalog();
|
||||
}
|
||||
}
|
||||
|
||||
public static class DoesNotSupportRowValueConstructorSyntax implements DialectCheck {
|
||||
public boolean isMatch(Dialect dialect) {
|
||||
return dialect.supportsRowValueConstructorSyntax() == false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue