named-query

Getting 'Named query not found' with Spring framework

I have a Java class (Entity) with a set of named queries. When the Spring tries to inject the related bean, it is not finding one of the queries. As example: @NamedQueries({ @NamedQuery(name = "Query1", query = "..."), @NamedQuery(name = "Query2", query = "..."), @NamedQuery(name = "Query3", query = "..."), ...

NHibernate, how to read NamedQuery result metadata?

I have an sql-query define on my nhibernate mapping file, that call an stored procedure to select some records. <sql-query name="sp_MYSP"> exec MYDBSP :param1, :param2, :param3 </sql-query> On code, I call the named query in this way: IQuery myQuery= Session.GetNamedQuery("sp_MYSP"); myQuery.SetString("param1", p1); myQu...

Trouble with hibernate's named query

I am new to hibernate and I am having some trouble with the named query annotation. My code is as follows and is more or less generated by NetBeans The BasicUser class: package wmc.model; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Colu...

JPA createNamedQuery syntax

Hello, In Pro JPA 2 (Apress) book, I have seen examples like, EntityManager em; Long count = em.createNamedQuery(countQueryName, Long.class).getSingleResult(); But, the api , hopefully applied to JPA 2.0, shows the syntax as createNamedQuery(String name) Parameters: name - the name of a query defined in metadata with a single p...

JAVA: NamedQuery String problem

Hello guys I am having some problems with exact matches while doing a NamedQuery. I am currently using something like this: @NamedQuery(name = MyClass.GET_ENTRY_BY_NAME, query = "select e from Entry e where e.name =:"+ Entry.NAME ) ... Query query = em.createNamedQuery(MyClass.GET_ENTRY_BY_NAME); query.setParameter(Entry.NAME...

Is there any size limit in arraylist used in "where in" in java named query

as title, thanks! ...

Is there an EclipseLink equivalent of "hibernate.query.startup_check"?

I am using annotational entity configuration with EclipseLink/JPA and need to disable named query validation upon startup. Is there an EclipseLink equivalent property to: hibernate.query.startup_check=false ...

How can I handle a possibly empty parameter List when using a named query in NHibernate?

I'm having issues on handling a situation where a list of parameters sent to a named query in NHibernate is empty. This is an example of my situation: <sql-query name="MyClass_FilterByCategoryID"> <return alias="MyClass" class="MyProject.BusinessEntities.MyClassBE"/> <![CDATA[ SELECT DISTINCT MyClass.* FROM MyClassTable...

Combine NamedQuery and Criteria in Hibernate

I use Hibernate in a storefinder application. For the proximity search in SQL I use the haversine formula. Because this is a bit messy SQL I created a named SQL query in my .hbm.xml File for this. SELECT location.*, ( 3959 * acos( cos( radians(7.4481481) ) * cos( radians( X(location.coordinates) ) ) * cos( radians( ...

Joining named queries in JPA

Hi All, I want to know whether I can join 2 named queries in JPA. As an example I have two following named queries 1 - Get all the active users 2 - get all the users for a given company Is it possible for me to join above two named queries and get get all the active users for a given company. If possible pls send me some reference...