JPQL « Data Type « JPA Q&A





1. Compare two dates with JPA    stackoverflow.com

I need to compare two dates in a JPQL query but it doesn't work. Here is my query: Query query = em.createQuery("SELECT h FROM PositionHistoric h, SeoDate d WHERE h.primaryKey.siteDb = :site AND ...

2. How to get the database time with JPQL?    stackoverflow.com

with native SQL I get the database time with a statement like:

SELECT CURRENT_TIMESTAMP
with JPQL I get the same result with:
SELECT CURRENT_TIMESTAMP
FROM Customer c
WHERE c.id=1
Is there a way to get rid of ...

3. Are there date functions available in jpql?    stackoverflow.com

I want to write query something like :-

Select u from bookmaster u order by Year(b.createDate),Month(b.createDate),day(b.createDate) 
How do i do this in JPQL? Are there any date parsing functions available?

4. Is there an equivelent of views in jpql?    stackoverflow.com

If I have a complex where clause which varies only slightly between many queries, in SQL I would create a view based on most of the where clause, then query the ...

5. Java: JPQL date function to add a time period to another date    stackoverflow.com

SELECT x FROM SomeClass
WHERE x.dateAtt BETWEEN CURRENT_DATE AND (CURRENT_DATE + 1 MONTH)
In the above JPQL statement, SomeClass has a memebr dateAttr, which is a java.util.Date and has a @Temporal(javax.persistence.TemporalType.DATE) annotation. I need ...

6. JPA Date Arithmetic?    stackoverflow.com

Is it possible to perform date arithmetic using JPA/Hibernate? For example, I have an entity with a java.util.Date field indicating when the row was created. Is it possible to ...

7. jpql limit number of results    stackoverflow.com

how to limit the number of results from database when I don't care about the other?

select e from Entity e /* just ten results, howto? */

8. Using JPA 2.0 Criteria API and cast causes generated JPQL to fail in Hibernate    stackoverflow.com

I am a first time user of the new JPA 2.0 Criteria API and I 'm running into a problem when I need to cast a number field to String to ...

9. String functions in JPA in toplink (OAS 10.1.3.n)    stackoverflow.com

I am trying the following query:

SELECT DISTINCT SUBSTRING(c.name, 1, 1) FROM Country c
againest toplink that is bundled with Oracle Application Server 10.1.3.3 but I got an error saying: SUBSTRING token not recognized The ...





10. Compare date only (without time) in JPA2 (JPQL)    stackoverflow.com

Im trying to compare Calendars with JPA2. The query looks somewhat like that:

TypedQuery<X> q = em.createQuery("select r from Record r where r.calendar= :calendar", X.class);
Calendar c = foo(); // setting fields and ...

11. set parameter which is null in @NamedQuery (JPA QL 1.0)    stackoverflow.com

I am writing a JPA QL named query that would search for documents. This should be done in only one query and I cannot switch to native SQL (that's non functional ...

12. Database independent string comparison with JPA    stackoverflow.com

I'm working with JPA (Hibernate as provider) and an underlying MySQL database. I have a table containing every name of streets in Germany. Every streetname has a unique number. For one task ...

13. how get entities where Date - Date > than n (seconds)    stackoverflow.com

I have a problem. Need get entities, where Date - Date > than n (seconds).

    String query = "SELECT cdrs FROM CallDetailRecord cdrs 
      ...

14. JPA string comparison    stackoverflow.com

I've written a simple login system using a JPQL query, which always returns no result:

public boolean check(String name, String password) {
    final String qstring="SELECT e FROM Muser e ...

15. Problem in Date comparision in JPQL    coderanch.com

Hello Everyone, Is there any restrictions in JPQL for date equality comparision? My requirement is to get all the student's information based on the admission date. viz. If admissionDate is date-16.02.2010 time-15:03:08, then it should give me all the student's information who has admitted on date-"16.02.2010" time-"15:03:08" In my orm.xml mapping file, i've the following JPQL query defined: -----------clip--------- ...

16. Problem in Date comparision in JPQL    forum.hibernate.org

Hello Everyone, Is there any restrictions in JPQL for date equality comparision? My requirement is to get all the student's information based on the admission date. viz. If admissionDate is date-16.02.2010 time-15:03:08, then it should give me all the student's information who has admitted on date-"16.02.2010" time-"15:03:08" In my orm.xml mapping file, i've the following JPQL query defined: -----------clip--------- ...





17. Hibernate JPQL support for boolean literals    forum.hibernate.org