openjpa « Query « JPA Q&A





1. SELECT NEW in JPQL    stackoverflow.com

I'm having an issue with a SELECT NEW query.

Query q = em.createQuery(
           "SELECT NEW com.bcbst.odstats.ejb.RangeStats(a.folderName, SUM(a.hits)) " +  
  ...

2. Help with JPQL query    stackoverflow.com

I have to query a Message that is in a provided list of Groups and has not been Deactivated by the current user. Here is some pseudo code to illustrate the ...

3. sql query with space in the value    stackoverflow.com

How do I write where clause where the value has spaces: Actually I am using openJPA and I have to set parameter. The value i will be setting has a space, eg: String somevalue="firstname ...

4. select from two tables using JPQL    stackoverflow.com

I m using JPQL to retrieve data. I can get data using the statement

List persons = null;
persons = em.createQuery("select p.albumName from PhotoAlbum p , Roleuser r 
where r = p.userId and ...

5. Can we assign custom Query Hints to JPA NamedQueries    stackoverflow.com

We are required to append query numbers to each and every query our application executes. EX: SELECT * FROM ... WHERE ... QUERYNO 123456; OpenJPA supports query hints, but only for ...

6. OpenJPA: how to construct a GROUP BY query with a group count    stackoverflow.com

In JPQL I want to construct the equivalent query to this:

select *, count(*) as finger_count from page_delta_summary 
where delta_history_id = ? and change_type = ? group by fingerprint;
where fingerprint is a ...

7. Slow Performing OpenJPA Query    stackoverflow.com

I have the following query method that has slow performance:

@Override
public Map<String, Long> getFeatureCounts() {

    StopWatch timer = new StopWatch();
    timer.start();
    Map<String, Long> ...

8. why is OpenJPA 2.1 throwing ArgumentException when using a critera query and equal(x,object)?    stackoverflow.com

Why does this work:

    builder = em.getCriteriaBuilder();
    log.log(Level.INFO,"***22***");
    CriteriaQuery<ClaimVersion> criteriaClaimVersion = builder.createQuery(ClaimVersion.class);
    log.log(Level.INFO,"***33***");
    rootClaimVersion = criteriaClaimVersion.from(ClaimVersion.class);
 ...

9. How to write named native subqueries in JPA?    stackoverflow.com

I was given a task to write a named native subquery like

select c.comp_name from company c where c.cid = (select cid from com_usr_rel where uid=1100)
The entities are company
@Entity

public class Company implements Serializable ...





10. Subqueries in JPA is not working with OpenJPA    coderanch.com

Does JPA support subqueries in the select part of the main query. For example : SELECT record1.txnId, record1.accessTime, (SELECT record2.accessTime FROM Metering record2 WHERE record2.txnId=record1.txnId AND record2.action='END') FROM Metering record1 WHERE record1.action='START' The above query is properly working with Hibernate implementation. But when i use OpenJPA implementation instead of Hibernate implementation it is giving the following error: org.springframework.dao.InvalidDataAccessApiUsageException: Encountered "(" at ...