spring-projects/spring-data-jpa — pull request #110 by thomasdarimont (2014-10-23 13:01:52+00:00)
Title: DATAJPA-617 - Avoid potential transaction roll backs during named query lookups.

We now use a dedicated EntityManager for the named query lookup in NamedQuery.hasNamedQuery(..). Previously we used the given EntityManager to lookup the named query which cause transaction to be rolled back due to the Exception thrown in the case that the named query couldn't be found.
Added fast path to NamedQuery.lookupFrom(..) that now uses NamedQuery.hasNamedQuery(...) to test if a query exists or not.
Pulled the check for the presence of a namedCountQuery from doCreateCountQuery up to the NamedCountQuery constructor. This makes sure that the check is only performed once.