About query

forum_thread

Duplicate Entity class names causes Exception in Query

I have two Entities which have the same class name but reside in different packages, only one of them is mentioned in the persistence.xml. I a NamedQuery I use the unqualified class name of one of these entities. If I execute that query I get an exception;   ... class name of one of these entities. If I execute that query I get an exception;   Caused by: ... 64 more Here is the class doing the query on objdbTest.Item package objdbTest ;   import ... ( name = "objdbTest.Singleton.getItem" , query = "SELECT o FROM Item o WHERE o.cachedKey = :cachedKey" ) ...

 
forum_thread

query on calendar class

Hello!   I'm looking for help to build query on calendar class. I need to get objects where Calendar.DAY_OF_WEEK is FRIDAY or any other. My class: @Entity public class Cdr {     private static final long serialVersionUID = 1L;        @Id @GeneratedValue     private long serialID;     private String A;     @Temporal(TemporalType.TIMESTAMP) private Calendar start; I tested: ...   I'm looking for help to build query on calendar class. I need to get objects where Calendar.DAY_OF_WEEK is ... private Calendar start ; I tested: Query query = em . createQuery ( "SELECT c FROM Cdr c where ...

 
forum_thread

Getting sales quantity per country with a query, an idea anyone?

Hi, For the purpose of some charts on a dashboard for our ERP i would like to get the list of countries and the sales quantity for each of them. I am pretty sure it is somehow possible to get that directly from a more or less complex query but i failed to find it; Does any have an idea? The entity (we call it OrderData) contains fields and other entities related to an order, fields we are interrested in are  buyerCountry and orderPrice. ... possible to get that directly from a more or less complex query but i failed to find it; Does any have an idea? The entity (we ... be able to retrieve that information using a GROUP BY query . ObjectDB Support ObjectDB - Fast Object ...

 
forum_thread

IN operator syntax

Hi, what is the correct syntax for IN operator when list of literals ia used instead of parameter, e.g. SELECT FROM Info i WHERE i.status IN (1,4) ? (Suppose status is int.) I always get this exception: SELECT FROM Info i WHERE i.status IN (1 ==> , <== 4) javax.persistence.PersistenceException Unexpected query token ',' (closing ')' is missing) (error 752)   Query with only one item in list works fine: ... javax.persistence.PersistenceException Unexpected query token ',' (closing ')' is missing) (error 752)   Query with only one item in list works fine: SELECT FROM Info i ...

 
forum_thread

"where in" query

Is it possible to run a query selecting values that exist in a provided list? e.g. something like: SELECT u FROM User m WHERE u.username IN ('test_user','anotheruser') I've tried various combinations of this including passing the list as a named parameter but without any joy. The only similar examples I can find in the docs involve a join query - but my list isn't in the database - and the MEMBER OF operator doesn't seem to do what I want (although I may be using it incorrectly! ... Is it possible to run a query selecting values that exist in a provided list? e.g. something like: ... similar examples I can find in the docs involve a join query - but my list isn't in the database - and the MEMBER OF operator ...

 
forum_thread

Problem of query With an aggregate function

Hi I would know if this type of query is supported By JPA: select sum(nb1), sum(nb2), sum(nb3) from table If yes I have this methode that return a list of Long: ... Hi I would know if this type of query is supported By JPA: SELECT sum ( nb1 ) , sum ... ( Choix choix ) { Query listClassRepHost = em. createQuery ( "SELECT ...

 
issue

Incorrect entity returned by query

Hello, during the analysis of a bug in our program we found an issue with a query that does not return the expected entity. We have attached the corresponding database. The query is: SELECT dep FROM UsedInDependency AS dep WHERE dep.sheet.uid == '317j' AND dep.source.row.q + dep.source.row.offsetEntry.offset >= 1 AND dep.source.row.q + dep.source.row.offsetEntry.offset <= 1 AND dep.target.row.q + dep.target.row.offsetEntry.offset > 1   ... analysis of a bug in our program we found an issue with a query that does not return the expected entity. We have attached the corresponding database. The query is: SELECT dep FROM UsedInDependency AS dep WHERE ... We expect it to find entity 318E, however, the query returns the entity with UID: 318F. However, the returned entity does not ...

 
forum_thread

Query for objects persisted within the same transaction

I have a question concerning reading uncommited entities with query, within active transaction. For example, I read data from file. Each line contains value of one of entity's attributes but those values are not unique, so it's possible to have a multiple instances of the same entity. To eliminate duplicates, after reading every line I first check using a query, if an entity with that attribute value already exists. If no - I create one and persist it.... a question concerning reading uncommited entities with query, within active transaction. For example, I read data from file. ... duplicates, after reading every line I first check using a query, if an entity with that attribute value already exists. If no - I create ...

 
api-jpa

JPA Annotations for SQL Queries

Reference (JavaDoc) of JPA 2 sql query annotations.... ObjectDB supports only the preferred JPA query language, JPQL, and silently ignores all the above annotations. ...

 
forum_thread

Query to find object from element of a contained collection

I have an OrderData class, containing an ItemData collection, i would like to find OrderData elements by ItemData.items.itemId. I cant get a proper query with MEMBER OF or IN. Does anyone have an idea on how i could formulate that as Typed or CriteriaBuilder query? Thanks.   ... by OrderData.items.itemId. I cant get a proper query with MEMBER OF or IN. Does anyone have an idea on how i could formulate that as Typed or CriteriaBuilder query? Thanks.   @ Entity public ...