FetchMode in JPA 2 CriteriaQuery

后端 未结 1 1714
甜味超标
甜味超标 2020-12-09 18:52

I\'m currently in the process of switching from Hibernate to pure JPA 2 (which by the way turned out to be much more time consuming than I initially expected).
The bigge

相关标签:
1条回答
  • 2020-12-09 19:21

    Try this:

    CriteriaQuery<Person> c = cb.createQuery(Person.class);
    Root<Person> person = c.from(Person.class);
    person.fetch("address");
    c.select(person);
    

    Assuming there is a one-to-one relationship between your Person entity and an Address entity.

    0 讨论(0)
提交回复
热议问题