jpql « HQL « JPA Q&A





1. Get Random Rows Using JPQL    stackoverflow.com

Is it possible to use JPQL for getting random rows? For example in SQL Server I would use: select * from myTable where columnName = 4 order by newid() Thanks, Rod

2. JPQL to get nearest records by latitude and longitude    stackoverflow.com

I'm have entities with latitude and longitude and I would like to select those nearest to a given point. I found this example that looks like it would work

SELECT *,
   ...

3. JPA/Hibernate and messed up named parameters    stackoverflow.com

My simple query looks like this on JPQL:

SELECT COUNT(r) FROM org.domain.Resource r WHERE r._parent = :parent AND r._metadata[:metadataKey] is not null
But Hibernate SQL output looks like this (both for H2 and ...

4. JPQL get most recent rows    stackoverflow.com

Let's say I have the following tables

my_profile_data
-------------
integer: my_profile_data_id
integer: profile_id
integer: profile_data_type_id
date: date_changed
string: value

my_profile
-------------
integer: profile_id
string: name

profile_data_type
-------------
integer: profile_data_type_id
string: name
I want to get the most recent profile information for each profile data type. In ...

5. Hibernate using OneToOne    stackoverflow.com

I have two tables

tab1 { col1 (PK), col2, col3 }

tab2 { col1, col2(PK), col3 }
I am using Hibernate annotation for joining using "OneToOne" I have the below Hibernate class for tab1
class tab1 ...

6. Does JPQL have single- and/or multi-line comments?    stackoverflow.com

Question says it all... If they exist, which characters are used?

7. Need help on Hibernate and JPQL syntax    stackoverflow.com

I am new to play framework and hibernate , I have a simple problem that I am unable to solve

public static void listMembers(int page,int pageSize,String[] fields,String[] values) { 
   ...

8. Write & Call user-defined function in JPQL?    stackoverflow.com

Is it possible to write & call user-defined function in JPQL?

9. JPQL and clausole IN, not found    stackoverflow.com

i have the following situation: In the dao class:

...
Query q = em.createNamedQuery("myQuery");
q.setParameter("attr", "value");
List<MyObj> listMyObj = q.getResultList();
...
In my file orm.xlm, i defined this query:
<named-query name="myQuery">
    <query><![CDATA[
     ...





10. Usecases that really need Hibernate HQL over JPQL    stackoverflow.com

I know JPQL is a subset of HQL. Are there any practical usecases (please give examples) that really need HQL specific features to be used (that means it is impossible or ...

11. JPQL-data missing    forums.netbeans.org

when I say em.createQuery("Select o.processName,t.taskName from TbdbProcesstable o JOIN o.TbdbTasktable t "); I get only the partial results. Because in TbdbProcesstable I've processName as Leave,PF and there is a corresponding entry ...

12. Question on JPQL...    coderanch.com

Hi, I need help in formulating a JPQL query in this situation: 1. I have Customer and Order entities and I want all the Customers who have ordered something. I am thinking: select c from Customer c, In(c.orders) o Is that correct? Would the query be different in EJBQL and JPQL for this situation? 2. What if I want all the ...

13. Using MOD in JPQL    coderanch.com

I have a long variable mapped to a database column, representing a date and time, in the form YYYYMMDDhhmm. So for example, midday today would be represented by the long value 200911051200L. I need to be able to run queries using JPQL against each of the individual components - year, month, etc. In order to access the month, for example, I ...

14. Is there any Tool for JPQL    coderanch.com

15. differences between HQL and JPQL    coderanch.com

16. JPA, JPQL and the lack of certain features.    coderanch.com

Hello!: Although JavaRanch has appeared many times among the results of my searches on Google, this is my first message here. Finally I decided to register and see what happens. So, first, hello to you all . For the last year I've been learning a little about EJB and the JPA. This took me to learn the ins and outs of ...





17. Basic understanding of JPQL and HQL    coderanch.com

18. [JPQL] UNION    coderanch.com

Hi! It is possible to do an "UNION" in JPQL or something like this? Because I have a abstract class ("Table a") which has 3 different subclass ("Table b", "Table c", "Table d") and when I execute my query I don't know in advance what kind of subclass I need. Thanks in advance!

19. JPQL WHERE IN Help    coderanch.com

Hello to all - I'm working with JPA for the first time, and have come across a problem I can't seem to find a solution for, executing a WHERE IN native query. Entity Class: @NamedQuery(name = "Event.findByBranches", query = "SELECT e FROM Event e WHERE e.location IN (:branches)"), From EntityManagerController: @PersistenceContext ( unitName = "tmbcPU" ) EntityManager manager; public Collection getEventsByFilter ...

20. Basic understanding of JPQL and HQL    forum.hibernate.org

Just to make sure you know that: JPA is a specification on how to do OR-Mapping. Hibernate is one implementation of it, so it offers all JPA-features plus a some more useful features. So JPQL is also a specification on how to query objects, HQL is a kind of implementation. Actually, when using Hibernate as ORM-Tool you will never feel there ...

21. Please help me with JPQL    forum.hibernate.org

22. Simple JPQL (relational traversal) not working?    forum.hibernate.org

Beginner Joined: Thu Jan 31, 2008 7:09 am Posts: 34 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.2.6.ga 3.3.2.GA Mapping documents: package zeuzgroup.domain.entity; import java.util.ArrayList; import java.util.List; import javax.persistence.AttributeOverride; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import org.domdrides.entity.UuidEntity; @Entity public class City extends UuidEntity { private static final long serialVersionUID = ...

23. JPQL question about multiple counts    forum.hibernate.org

This is the sql that is output from Hibernate log: Code: /* select count(distinct us), count(distinct u), count(distinct q) from UserSession ...

24. JPQL    forums.oracle.com