Skip to content

Commit 338f890

Browse files
committed
Merge branch '5.3.x'
2 parents 8382703 + fdd6e50 commit 338f890

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/docs/asciidoc/data-access.adoc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,10 +2444,10 @@ the `TransactionOperator` resembles the next example:
24442444
}
24452445
24462446
public Mono<Object> someServiceMethod() {
2447-
2447+
24482448
// the code in this method runs in a transactional context
2449-
2450-
Mono<Object> update = updateOperation1();
2449+
2450+
Mono<Object> update = updateOperation1();
24512451
24522452
return update.then(resultOfUpdateOperation2).as(transactionalOperator::transactional);
24532453
}
@@ -8212,11 +8212,17 @@ that uses the `@PersistenceUnit` annotation:
82128212
}
82138213
82148214
public Collection loadProductsByCategory(String category) {
8215-
try (EntityManager em = this.emf.createEntityManager()) {
8215+
EntityManager em = this.emf.createEntityManager();
8216+
try {
82168217
Query query = em.createQuery("from Product as p where p.category = ?1");
82178218
query.setParameter(1, category);
82188219
return query.getResultList();
82198220
}
8221+
finally {
8222+
if (em != null) {
8223+
em.close();
8224+
}
8225+
}
82208226
}
82218227
}
82228228
----

0 commit comments

Comments
 (0)