use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class BulkManipulationTest method testInsertWithSelectListUsingJoins.
@Test
@SkipForDialect(value = CUBRIDDialect.class, comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables")
public void testInsertWithSelectListUsingJoins() {
// this is just checking parsing and syntax...
Session s = openSession();
s.beginTransaction();
s.createQuery("insert into Animal (description, bodyWeight) select h.description, h.bodyWeight from Human h where h.mother.mother is not null").executeUpdate();
s.createQuery("insert into Animal (description, bodyWeight) select h.description, h.bodyWeight from Human h join h.mother m where m.mother is not null").executeUpdate();
s.createQuery("delete from Animal").executeUpdate();
s.getTransaction().commit();
s.close();
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class CoalesceTest method HHH_10463_NullInCoalesce.
@Test
@SkipForDialect(jiraKey = "HHH-10463", value = PostgreSQL81Dialect.class)
@SkipForDialect(jiraKey = "HHH-10463", value = Oracle8iDialect.class)
public void HHH_10463_NullInCoalesce() {
doInHibernate(this::sessionFactory, session -> {
Query query = session.createQuery("from Person p where p.name = coalesce(:name, p.name) ");
query.setParameter("name", null);
List<Person> resultList = query.getResultList();
assertThat(resultList, hasItem(person));
});
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class BulkManipulationTest method testDeleteWithMetadataWhereFragments.
@Test
@SkipForDialect(value = CUBRIDDialect.class, comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables")
public void testDeleteWithMetadataWhereFragments() throws Throwable {
Session s = openSession();
Transaction t = s.beginTransaction();
// Note: we are just checking the syntax here...
s.createQuery("delete from Bar").executeUpdate();
s.createQuery("delete from Bar where barString = 's'").executeUpdate();
t.commit();
s.close();
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class HQLTest method testRowValueConstructorSyntaxInInListBeingTranslated.
@Test
@SkipForDialect(value = { Oracle8iDialect.class, AbstractHANADialect.class, PostgreSQL81Dialect.class, MySQLDialect.class })
public void testRowValueConstructorSyntaxInInListBeingTranslated() {
QueryTranslatorImpl translator = createNewQueryTranslator("from LineItem l where l.id in (?)");
assertInExist("'in' should be translated to 'and'", false, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in ?");
assertInExist("'in' should be translated to 'and'", false, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in (('a1',1,'b1'),('a2',2,'b2'))");
assertInExist("'in' should be translated to 'and'", false, translator);
translator = createNewQueryTranslator("from Animal a where a.id in (?)");
assertInExist("only translated tuple has 'in' syntax", true, translator);
translator = createNewQueryTranslator("from Animal a where a.id in ?");
assertInExist("only translated tuple has 'in' syntax", true, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in (select a1 from Animal a1 left join a1.offspring o where a1.id = 1)");
assertInExist("do not translate sub-queries", true, translator);
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class FooBarTest method testRefresh.
@SkipForDialect(value = AbstractHANADialect.class, comment = "HANA currently requires specifying table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause")
@Test
public void testRefresh() throws Exception {
final Session s = openSession();
s.beginTransaction();
Foo foo = new Foo();
s.save(foo);
s.flush();
s.doWork(new AbstractWork() {
@Override
public void execute(Connection connection) throws SQLException {
final String sql = "update " + getDialect().openQuote() + "foos" + getDialect().closeQuote() + " set long_ = -3";
Statement st = connection.createStatement();
st.executeUpdate(sql);
}
});
s.refresh(foo);
assertEquals(Long.valueOf(-3l), foo.getLong());
assertEquals(LockMode.READ, s.getCurrentLockMode(foo));
s.refresh(foo, LockMode.UPGRADE);
if (getDialect().supportsOuterJoinForUpdate()) {
assertEquals(LockMode.UPGRADE, s.getCurrentLockMode(foo));
}
s.delete(foo);
s.getTransaction().commit();
s.close();
}
Aggregations