use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.
the class InformixDialectTestCase method testCurrentTimestampFunction.
@Test
@TestForIssue(jiraKey = "HHH-10800")
public void testCurrentTimestampFunction() {
Map<String, SQLFunction> functions = dialect.getFunctions();
SQLFunction sqlFunction = functions.get("current_timestamp");
Type firstArgumentType = null;
Mapping mapping = null;
assertEquals(StandardBasicTypes.TIMESTAMP, sqlFunction.getReturnType(firstArgumentType, mapping));
firstArgumentType = null;
List arguments = Collections.emptyList();
SessionFactoryImplementor factory = null;
assertEquals("current", sqlFunction.render(firstArgumentType, arguments, factory));
}
use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.
the class InformixDialectTestCase method testCurrentDateFunction.
@Test
@TestForIssue(jiraKey = "HHH-10800")
public void testCurrentDateFunction() {
Map<String, SQLFunction> functions = dialect.getFunctions();
SQLFunction sqlFunction = functions.get("current_date");
Type firstArgumentType = null;
Mapping mapping = null;
assertEquals(StandardBasicTypes.DATE, sqlFunction.getReturnType(firstArgumentType, mapping));
firstArgumentType = null;
List arguments = Collections.emptyList();
SessionFactoryImplementor factory = null;
assertEquals("today", sqlFunction.render(firstArgumentType, arguments, factory));
}
use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.
the class SQLServer2005DialectTestCase method testAppendLockHintUpgradeNoTimeout.
@Test
@TestForIssue(jiraKey = "HHH-9635")
public void testAppendLockHintUpgradeNoTimeout() {
final String expectedLockHint = "tab1 with (updlock, rowlock, nowait)";
LockOptions lockOptions = new LockOptions(LockMode.UPGRADE);
lockOptions.setTimeOut(LockOptions.NO_WAIT);
String lockHint = dialect.appendLockHint(lockOptions, "tab1");
assertEquals(expectedLockHint, lockHint);
}
use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.
the class QueryBuilderTest method testMissingDialectFunction.
@Test
@TestForIssue(jiraKey = "HHH-10737")
@FailureExpected(jiraKey = "HHH-10737")
public void testMissingDialectFunction() {
doInJPA(this::entityManagerFactory, em -> {
Human human = new Human();
human.setId(200L);
human.setName("2");
human.setBorn(new Date());
em.persist(human);
em.getTransaction().commit();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<HumanDTO> criteria = cb.createQuery(HumanDTO.class);
Root<Human> root = criteria.from(Human.class);
criteria.select(cb.construct(HumanDTO.class, root.get(Human_.id), root.get(Human_.name), cb.function("convert", String.class, root.get(Human_.born), cb.literal(110))));
em.createQuery(criteria).getResultList();
});
}
use of org.hibernate.testing.TestForIssue in project hibernate-orm by hibernate.
the class QueryBuilderTest method testMultiselectWithPredicates.
@Test
@TestForIssue(jiraKey = "HHH-8699")
// For now, restrict to H2. Selecting w/ predicate functions cause issues for too many dialects.
@RequiresDialect(value = H2Dialect.class, jiraKey = "HHH-9092")
public void testMultiselectWithPredicates() {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
CriteriaBuilderImpl cb = (CriteriaBuilderImpl) em.getCriteriaBuilder();
CriteriaQuery<Customer> cq = cb.createQuery(Customer.class);
Root<Customer> r = cq.from(Customer.class);
cq.multiselect(r.get(Customer_.id), r.get(Customer_.name), cb.concat("Hello ", r.get(Customer_.name)), cb.isNotNull(r.get(Customer_.age)));
TypedQuery<Customer> tq = em.createQuery(cq);
tq.getResultList();
em.getTransaction().commit();
em.close();
}
Aggregations