NamedQuery « Query « JPA Q&A





1. How do you decide in which entity classes to put JPA NamedQuery annotations?    stackoverflow.com

Say I have a Customer - CustomerOrder one-to-many bi-directional relationship with the CustomerOrder holding the total value of each order. If I had a query to find the total value of all ...

2. @NamedQuery select parameter meaning    stackoverflow.com

Found some examples of @NamedQuery annotations,e.g.:

@NamedQuery(name="employeeBySsn" query="select e from Employee e where e.ssn = :ssn")
what does parameter e mean? the second usage of it seems like alias name of table and what ...

3. Question about JPQL, @NamedQuery    stackoverflow.com

If I have something like this

@Entity
public class Facility {
    ...
    @ManyToOne
    @JoinColumn(name="CUSTOMER_FK")
    private Customer customer;
    ...
}
does ...

4. JAVA: NamedQuery String problem    stackoverflow.com

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 ...

5. Combine NamedQuery and Criteria in Hibernate    stackoverflow.com

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 ...

6. nhibernate NamedQuery from criteriaQuery --> help needed    stackoverflow.com

I am trying to convert a working criteria query into a named query, and not getting the syntax right. The hql version apparently wants both the type and id params specified. ...

7. JPA: NamedQuery of name: not found    stackoverflow.com

I'm using Netbeans 6.9.1 and TopLink Essentials for the JPA. I had followed the necessary steps for JPA connection. Yet when I execute a named query in a particular entity. This exception always return ...

8. NamedQuery: IllegalArgumentException (Query not found) after externalizing entities    stackoverflow.com

I have successfully used javax.persistence.NamedQuery in combination with JPA2. The named queries are defined at the top of the entity class files, and are used from Stateless EJBs (entity facade). Now I ...

9. Hibernate NamedQuery and AliasToBeanResultTransformer    stackoverflow.com

So I'm doing something like the following in a Hibernate named query called "orgUserReport":

<return alias="org" class="com.mysite.model.Org"/>
<return alias="user" class="com.mysite.model.User"/>
select
 o.* as org,
 u.* as user
from
 user u, org o
where
 u.org_id = o.org_id
I've ...





10. JPA NamedQuery get distinct column    stackoverflow.com

I want to get an list of distinct City's from my User table. I thought the code below would work but gives an error:

User.java
@Entity
@Table(name="user_info")
...
@NamedQuery(name = "User.all.cities", query = "SELECT distinct ...

11. Is it good practice to use @NamedQuery for single column selects (J2EE/JPA, Hibernate)    stackoverflow.com

I'm working on J2EE 6 codebase that uses Hibernate as its persistence provider. My experience lies more in Spring and I'm quite new to JPA annotations and similar, but I've ...

12. [JPA] NamedQuery : Ordering results with function    java.net

Hi, First of all, please, target BBCode help link to a blank page... I had to rewrite my post. (And [ code ] tag lets showing html br tags) So, I'm trying to declare a NamedQuery in which I order the rows by the result of the COALESCE function. I'm using GF 3.0.1 b22, with EclipseLink 2.1.x I tried many ways ...

13. NamedQuery / createQuery with filter    forum.hibernate.org

Class Question ... // INFORMY_ID is a FK in Question table and the PK of Informy @ManyToOne @JoinColumn(name="INFORMY_ID") ...

14. SQL query as namedQuery ?    forum.hibernate.org

Hellu, I am using hibernate version 2.1.1. I have all my HQL queries documented as named queries in the mapping files through the query tag. I now have a native SQL query as Hibernate doesn't support subqueries in the FROM. How is the best thing to deal with this such that I document it outside my source and use it in ...

15. Parameters in Order by clause and NamedQuery    forum.hibernate.org

from my.package.path.Application as app Query namedQuery = this.getHibernateTemplate().getNamedQuery( this.getSession(), ALL_APPS_QUERY); StringBuffer orderedQuery = new StringBuffer( namedQuery.getQueryString()); orderedQuery.append(" order by "); if (chunk.getSortItem() != null) { orderedQuery.append("app."); ...

16. Select Discinct in NamedQuery    forum.hibernate.org

Newbie Joined: Tue Jan 09, 2007 12:45 pm Posts: 13 I am geting exception while doing a distinct query in named query. I have also specified the return-type tag. but I still get exception. Below are my resource file, and the problem named query is 'GetAllRegion' The resource files are

17. Sub query in @NamedQuery ? (with order by and rownum)    forum.hibernate.org

I have a query which join many tables and retrives a sorted list of objects. If my parent table has two children records, i am getting a list of 3 records as result. So i have used rownum to get only one(first) record. My query looks like this: @NamedQuery(name = "getResultByStatus", query = "select new com.Result(id, updatedDateH) from (select a.id as ...