About SELECT

api-jpa

getSelection()

Return the selection of the query, or null if no selection has been set.(Method of javax.persistence.criteria.AbstractQuery)

 
api-jpa

javax.persistence.Query

Interface used to control query execution.(Interface of JPA)

 
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: ... Query query = em . createQuery ( "SELECT c FROM Cdr c where c.start.DAY_OF_WEEK = ?1" , Cdr . class ) ... Query query = em . createQuery ( "SELECT c FROM Cdr c where c.start > {t '23:00:00'}" , Cdr . class ...

 
forum_thread

how to query by properties of onetomany relations? (Error 990)

the following code fails em.createQuery("select f from Foo f where f.bars.name = ?1", Foo.class).setParameter(1, barName) stacktrace: ... following code fails em. createQuery ( "select f from Foo f where f.bars.name = ?1" , Foo. class ) . ... specific query should be rewritten as follows: SELECT f FROM Foo f JOIN f . bars b WHERE b . name = ? 1 ...

 
forum_thread

New to Product & Having An Issue

Greetings ObjectDB Users! I'm new to the product, and I've setup a simple test after reading the tutorial, and I'm running into some issues with queries, specifically querying by primary key.   I have a domain object class Called Department, which has a member of type DomainId.  DomainId has two member fields:  String accountId and String objectId.  The following code shows these two classes.... ( name = "Department.findAll" , query = "SELECT d FROM Department AS d" ) , @ NamedQuery ( name = "Department.byName" , query = "SELECT d from Department AS d WHERE d.name = :name" ) , @ ...

 
forum_thread

JPA query of a Set of terms

Hi, Is it possible to write a JPA query to select objects that contain a collection of elements? For example, suppose I have a table that maps a search terms to pages: @Entity public class SearchIndex { @Index SearchTerm term; @Index Page page; } Now suppose I have an array of SearchTerm objects. ie. ... Hi, Is it possible to write a JPA query to select objects that contain a collection of elements? For example, ... already persisted. em. createQuery ( "SELECT DISTINCT si.page FROM SearchIndex si WHERE si.term ????" ,Page. class ...

 
forum_thread

Listing large number of complicated objects with paging.

Hi, For last few hours I was working on a problem with bad performance and memory problems with such a simple query: select prod from Product prod order by prod.id ASC Right now I have 55541 'Product' (attached to this post) entities in database and I'm trying to speed listing them with paging. The problem is, that running code that looks like this: ... and memory problems with such a simple query: SELECT prod FROM Product prod ORDER BY prod . id ASC ... icQuery = em. em . createQuery ( "select prod from Product prod order by prod.id ASC" , Product. class ) ...

 
forum_thread

ObjectDB CRUD Examples

Any place where I can find Netbeans examples for the basic create, read, update, delete methods using the EntityManager? i.e. public void create(Foo foo) {} public Foo read(Integer id) {} public List<Foo> read() {} public void update(Foo foo) {} public void delete(Foo foo) {} ... = ( List<Foo> ) criteriaQuery. select ( root ) ; em. getTransaction ( ... Is by using a Query? i.e. Query query = em.createQuery("SELECT foo FROM Foo foo"); There's no em.selectAll method or ...

 
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: ... of literals ia used instead of parameter, e.g. SELECT FROM Info i WHERE i . STATUS IN ( 1 , ... is int.) I always get this exception: SELECT FROM Info i WHERE i.status IN (1 ==> , <==  4) ...

 
forum_thread

JBOSS AS7 7.1.1 - Entity not persisted and createNamedQuery fire exception

I'm trying to have the guestbook example running in the following environment: jboss as 7.1.1 final oracle jdk 1.7.0_04 maven 3.0.4 objectdb 2.4.0_04 installed as a module of jboss No IDE is used for building the Guestbook.war only maven.   My GuestDAO code is as follows: ... name = "Guest.getAll" , query = "select g from guest.Guest g order by g.name" ) } ) ... query = this . em . createQuery ( "select g from guest.Guest g order by g.name" , Guest. class ) ; ...