Merge branch '5.3.x'

This commit is contained in:
Sam Brannen 2022-01-04 16:51:06 +01:00
commit 338f8907ac
1 changed files with 10 additions and 4 deletions

View File

@ -2444,10 +2444,10 @@ the `TransactionOperator` resembles the next example:
}
public Mono<Object> someServiceMethod() {
// the code in this method runs in a transactional context
Mono<Object> update = updateOperation1();
Mono<Object> update = updateOperation1();
return update.then(resultOfUpdateOperation2).as(transactionalOperator::transactional);
}
@ -8212,11 +8212,17 @@ that uses the `@PersistenceUnit` annotation:
}
public Collection loadProductsByCategory(String category) {
try (EntityManager em = this.emf.createEntityManager()) {
EntityManager em = this.emf.createEntityManager();
try {
Query query = em.createQuery("from Product as p where p.category = ?1");
query.setParameter(1, category);
return query.getResultList();
}
finally {
if (em != null) {
em.close();
}
}
}
}
----