Skip to content

Correct not compiling example code in Data Access docs #27886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/docs/asciidoc/data-access.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2444,9 +2444,9 @@ the `TransactionOperator` resembles the next example:
}

public Mono<Object> someServiceMethod() {

// the code in this method runs in a transactional context

Mono<Object> update = updateOperation1();

return update.then(resultOfUpdateOperation2).as(transactionalOperator::transactional);
Expand Down Expand Up @@ -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();
}
}
}
}
----
Expand Down