playframework « Query « JPA Q&A

1. How to do JPA query from view template in play

I'm trying to do a JPA query from a view template but it's not working (I've verified that there are records using phpMyAdmin). I know this should normally be done ...

2. Can I convert this Mysql query to JPA?

I'm fairly familiar with SQL but very new to the Java Persistence API. I'm using JPA through the Play Framework. I have the following MySql query that I'd like ...

3. Remove items using HQL "delete from where is empty" clause

I have two entities within a relationship

tag <-m:n-> software
and I want to delete all softwares which are not links to tags anymore after deleting particular tag. I write the HQL query ...

4. How to refresh an entity in a Future?

I am not really sure where my problem lies, as I am experimenting in two areas that I don't have much experience with: JPA and Futures (using Play! Framework's Jobs and ...

5. Play Framework - find Object with "Or" in the query

It is possible to use "AND" while querying for Objects in Entity like

Post.find("byTitleLikeAndAuthor", "%hello%", connectedUser).fetch();
but is it possible to user "OR" while querying, like
Post.find("byNameOrEmail", name, ...

6. Play! Framework - Running JPA query for range of values using IN

I have been trying to fetch values from database using IN. I realized that I need to write JPA query like IN (’UK’, ’US’, ’France’)  
so I tried ...

7. JPA column order in Play! framework

Im using Play! framework, and i have this in my model:

public class Dialer extends Model {
    public String offer;

8. Play framework JPA query nested object not available

I have three objects that are related to eachother.

class Club extends Model

   @OneToMany(cascade = CascadeType.ALL, mappedBy = "club")
   public Set<Car> cars;

class Car extends Model

   @ManyToOne(cascade ...

9. JPA queries with several conditions?

I'm working on a small game using the Play framework and JPA. I've read their documentation, and most of it is quite clear, but I really don't understand how ...

10. How to run a JPA Query in play Framework

I'm new to Play and also to hibernate and JPA. I'm using MySql DB and JPA I have included

import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;

import play.db.jpa.JPA;
import play.mvc.Controller;
import play.db.jpa.*;
I have this Query
List languages ...

11. Join query with JPA?

I'm having a hard time with this join query in my application. I have two classes, Encounter and CheckedEncounter. CheckedEncounter is a temporary model that I'm using to manage the Encounters ...

12. Add logic to a column as your querying using criteria api

I'm not even sure this is possible but I figured it's worth asking. I've been using native query's for this for a long time. Say I have this query.


13. PlayFramework JPA find on two columns

I was trying to query by Person and Event like this :

static void setProfile(Event event, Person person) {
    Register register = Register.find("byEventPerson", event, person).first();
but I get ...

14. how to implements find() or findById() methods for embeddedId in Play framework

I have worked with play framework lately for creating project, thanks you so much for my friends in this forum for your assist. Now days i have a problem in play ...

15. Play Framework - Pagination using JPA

It seems to be the following syntax didn't work. Do we have any alternate query for this?

As we know, from() and fetch() will work only on JPAQueryobject and the above code ...

16. JPA, playframework, select order by before group by

How can I write a query in "JPA" that will ORDER BY before the GROUP BY? For example :

select m from Message m where = (
  select distinct m2.conversation_id

17. Elegant way of finding intersection of Many-to-Many entities using Play

Let's say I have a Student entity like this implemented using the Play Framework's Model class:

public class Student extends Model {

    public String name;

    @ManyToMany(fetch ...

18. Easiest way to select within a model using JPQL

I have hibernate database with three model:

Article - which has is part of multiple categories (EDIT).
Category - which contains articles, and is part of an App
App - which has different categories
I ...

19. Play Framework/JPA: Find using dot notation works but same query using delete does not

Let's say I have a couple of entities that look like this:

public class Person extends Model {
    @JoinColumn(name = "fooId", nullable = false)