13
13
// Contributors:
14
14
// 02/01/2022: Tomas Kraus
15
15
// - Issue 1442: Implement New JPA API 3.1.0 Features
16
- package org .eclipse .persistence .jpa .test .criteria . model ;
16
+ package org .eclipse .persistence .jpa .test .criteria ;
17
17
18
18
import java .time .Duration ;
19
19
import java .time .LocalDate ;
29
29
import jakarta .persistence .criteria .CriteriaUpdate ;
30
30
import jakarta .persistence .criteria .Root ;
31
31
32
+ import org .eclipse .persistence .jpa .test .criteria .model .DateTimeEntity ;
32
33
import org .eclipse .persistence .jpa .test .framework .DDLGen ;
33
34
import org .eclipse .persistence .jpa .test .framework .Emf ;
34
35
import org .eclipse .persistence .jpa .test .framework .EmfRunner ;
@@ -227,9 +228,6 @@ public void testCriteriaQueryWhereLocalTime() {
227
228
cq .where (cb .and (cb .lessThan (entity .get ("time" ), cb .localTime ()), cb .equal (entity .get ("id" ), 4 )));
228
229
em .createQuery (cq ).getSingleResult ();
229
230
em .getTransaction ().commit ();
230
- } catch (Throwable t ) {
231
- t .printStackTrace ();
232
- throw t ;
233
231
} finally {
234
232
if (em .getTransaction ().isActive ()) {
235
233
em .getTransaction ().rollback ();
@@ -255,9 +253,6 @@ public void testCriteriaQueryWhereLocalTimeReturnsEmpty() {
255
253
List <DateTimeEntity > data = em .createQuery (cq ).getResultList ();
256
254
em .getTransaction ().commit ();
257
255
MatcherAssert .assertThat (data .size (), Matchers .equalTo (0 ));
258
- } catch (Throwable t ) {
259
- t .printStackTrace ();
260
- throw t ;
261
256
} finally {
262
257
if (em .getTransaction ().isActive ()) {
263
258
em .getTransaction ().rollback ();
@@ -281,9 +276,6 @@ public void testCriteriaQueryWhereLocalDate() {
281
276
cq .where (cb .and (cb .lessThan (entity .get ("date" ), cb .localDate ()), cb .equal (entity .get ("id" ), 4 )));
282
277
em .createQuery (cq ).getSingleResult ();
283
278
em .getTransaction ().commit ();
284
- } catch (Throwable t ) {
285
- t .printStackTrace ();
286
- throw t ;
287
279
} finally {
288
280
if (em .getTransaction ().isActive ()) {
289
281
em .getTransaction ().rollback ();
@@ -309,9 +301,6 @@ public void testCriteriaQueryWhereLocalDateReturnsEmpty() {
309
301
List <DateTimeEntity > data = em .createQuery (cq ).getResultList ();
310
302
em .getTransaction ().commit ();
311
303
MatcherAssert .assertThat (data .size (), Matchers .equalTo (0 ));
312
- } catch (Throwable t ) {
313
- t .printStackTrace ();
314
- throw t ;
315
304
} finally {
316
305
if (em .getTransaction ().isActive ()) {
317
306
em .getTransaction ().rollback ();
@@ -335,9 +324,6 @@ public void testCriteriaQueryWhereLocalDateTime() {
335
324
cq .where (cb .and (cb .lessThan (entity .get ("datetime" ), cb .localDateTime ()), cb .equal (entity .get ("id" ), 4 )));
336
325
em .createQuery (cq ).getSingleResult ();
337
326
em .getTransaction ().commit ();
338
- } catch (Throwable t ) {
339
- t .printStackTrace ();
340
- throw t ;
341
327
} finally {
342
328
if (em .getTransaction ().isActive ()) {
343
329
em .getTransaction ().rollback ();
@@ -363,9 +349,6 @@ public void testCriteriaQueryWhereLocalDateTimeReturnsEmpty() {
363
349
List <DateTimeEntity > data = em .createQuery (cq ).getResultList ();
364
350
em .getTransaction ().commit ();
365
351
MatcherAssert .assertThat (data .size (), Matchers .equalTo (0 ));
366
- } catch (Throwable t ) {
367
- t .printStackTrace ();
368
- throw t ;
369
352
} finally {
370
353
if (em .getTransaction ().isActive ()) {
371
354
em .getTransaction ().rollback ();
@@ -395,9 +378,6 @@ public void testCriteriaQuerySelectLocalTime() {
395
378
} else {
396
379
MatcherAssert .assertThat (86400000L + diffMilis , Matchers .lessThan (30000L ));
397
380
}
398
- } catch (Throwable t ) {
399
- t .printStackTrace ();
400
- throw t ;
401
381
} finally {
402
382
if (em .getTransaction ().isActive ()) {
403
383
em .getTransaction ().rollback ();
@@ -423,9 +403,6 @@ public void testCriteriaQuerySelectLocalDate() {
423
403
MatcherAssert .assertThat (diff .getYears (), Matchers .equalTo (0 ));
424
404
MatcherAssert .assertThat (diff .getMonths (), Matchers .equalTo (0 ));
425
405
MatcherAssert .assertThat (diff .getDays (), Matchers .lessThan (2 ));
426
- } catch (Throwable t ) {
427
- t .printStackTrace ();
428
- throw t ;
429
406
} finally {
430
407
if (em .getTransaction ().isActive ()) {
431
408
em .getTransaction ().rollback ();
@@ -449,9 +426,6 @@ public void testCriteriaQuerySelectLocalDateTime() {
449
426
em .getTransaction ().commit ();
450
427
long diffMilis = Duration .between (datetime , LocalDateTime .now ()).toMillis ();
451
428
MatcherAssert .assertThat (diffMilis , Matchers .lessThan (30000L ));
452
- } catch (Throwable t ) {
453
- t .printStackTrace ();
454
- throw t ;
455
429
} finally {
456
430
if (em .getTransaction ().isActive ()) {
457
431
em .getTransaction ().rollback ();
0 commit comments