[hibernate-dev] JPA 2.1 / EntityManagerFactory#addNamedQuery

Steve Ebersole steve at hibernate.org
Wed Jun 20 12:12:16 EDT 2012


On Wed 20 Jun 2012 11:07:11 AM CDT, Sanne Grinovero wrote:

> Indeed Hibernate Search (re)implements both
>   - javax.persistence.Query
>   - org.hibernate.Query
>
> It would be nice if you could create a "Base" class for us to extend,

There is already a base class for org.hibernate.Query... 
org.hibernate.internal.AbstractQueryImpl


> When is this "named query" going to be defined?
> It would be extremely useful for the purpose of Hibernate OGM to have
> an exhaustive list of the queries which are going to be needed at
> initialization time, to potentially "tune" generated schema to
> accommodate requirements of such queries.
>
> In other words, I hope this "named query override" doesn't mean to
> override named query definitions at runtime?

That is exactly the function of EntityManagerFactory#addNamedQuery in 
fact.  If a named query already exists under that given name, it is 
replaced.

--
steve at hibernate.org
http://hibernate.org


More information about the hibernate-dev mailing list