Example #1
0
 private void assertTimeoutOccursOnList() {
   FullTextQuery hibernateQuery = fts.createFullTextQuery(allSeikoClocksQuery, Clock.class);
   hibernateQuery.setTimeout(10, TimeUnit.MICROSECONDS);
   try {
     hibernateQuery.list();
     fail("timeout exception should happen");
   } catch (QueryTimeoutException e) {
     // good
   } catch (Exception e) {
     fail("Expected a QueryTimeoutException");
   }
   fts.clear();
 }
Example #2
0
  @SkipForDialect(
      value = PostgreSQLDialect.class,
      jiraKey = "JBPAPP-2945",
      comment = "PostgreSQL driver does not implement query timeout")
  public void testEnoughTime() {
    Transaction tx = fts.beginTransaction();

    FullTextQuery hibernateQuery = fts.createFullTextQuery(matchAllQuery, Clock.class);
    hibernateQuery.setTimeout(5, TimeUnit.MINUTES);
    List results = hibernateQuery.list();
    assertFalse(hibernateQuery.hasPartialResults());
    assertEquals(1000, results.size());

    tx.commit();
  }