This commit is contained in:
Yanming Zhou 2024-02-07 15:53:28 +08:00 committed by Gavin King
parent 3274776acc
commit af599d7d89
1 changed files with 2 additions and 2 deletions

View File

@ -152,7 +152,7 @@ Let's just stick it on the `Book` class:
----
@CheckHQL // validate the query at compile time
@NamedQuery(name = "#findByTitleAndType",
query = "select book from Book book where book.title like :titlen and book.type = :type")
query = "select book from Book book where book.title like :title and book.type = :type")
@Entity
public class Book { ... }
----
@ -167,7 +167,7 @@ Now the Metamodel Generator adds the following method declaration to the metamod
**/
public static List<Book> findByTitleAndType(@Nonnull EntityManager entityManager, String title, Type type) {
return entityManager.createNamedQuery(QUERY_FIND_BY_TITLE_AND_TYPE)
.setParameter("titlePattern", title)
.setParameter("title", title)
.setParameter("type", type)
.getResultList();
}