0

As far as I know, there's no JPA-equivalent to Hibernate's criteria. The advantage of Hibernate's criteria is that they can be constructed without having an active Persistence Context (Restrictions.XYZ, see Hibernate JavaDoc).

Is there anything equal to this within JPA? If not, is there any clear evidence available?

Laurel
  • 5,965
  • 14
  • 31
  • 57
PeteSabacker
  • 176
  • 8
  • I know about the Criteria API; That's not the question here. The question is: Using JPA's Criteria API, do I have to use the Entity Manager/PersistenceContext to create criterions? Is there any other possibility to formulate criterions in an object-oriented way WITHOUT using the Entity Manager/PersistenceContext? In Hibernate, there is. In JPA, there isn't. AFAIK. – PeteSabacker May 25 '16 at 12:21
  • Well, it seems that you did not read my question properly rather than me not considering to take a look at any tutorials; I was asking about CRITERIONS, referencing the JavaDoc, even mentioning that they can be constructed without using an active Persistence Context. Why do you look at the speck of sawdust in your brother's eye and pay no attention to the plank in your own eye? ;) – PeteSabacker May 25 '16 at 12:49

1 Answers1

0

JPA has CriteriaBuilder which can be obtained from the EntityManagerFactory. I don't know this Hibernate "Criterions" thing but it seems to serve a similar purpose ...