About SELECT

tutorial

Getting Started with JPA - Eclipse Project

Opening a JPA Maven console project in the Eclipse IDE.... Open the Maven project in Eclipse: Select File > Import... > Maven > Existing Maven Projects and click Next . Select the points-console directory as Root Directory and press ENTER . ...

 
forum_thread

ObjectDB Explorer query error: Unexpected query token 'value'

Hi, my entity is named "XXXValue": this has several attributes, one of these is "value". In query tab, if I do "select value from XXXValue", I get the error <Unexpected query token 'value'>. I try  "select XXXValue.value from XXXValue" and the error is the same. Queries on others attributes work fine.  Thanks! ... one of these is "value". In query tab, if I do "select value from XXXValue", I get the error <Unexpected query token 'value'>. I try  "select XXXValue.value from XXXValue" and the error is the same. Queries on ... Please try: SELECT v . value FROM XXXValue v or SELECT this . ...

 
forum_thread

Group by: list if no aggregate function is specified

Hello! In a query like SELECT parent, children FROM Parent parent LEFT JOIN p.children children GROUP BY parent maybe it would be good if it will return a list of Object[2], where the second object is a list of children of a parent. Because creating a query to get a list of parents, then fetching children list for each parent - not a good idea. Thank you. ... Hello! In a query like SELECT parent, children FROM Parent parent LEFT JOIN p.children children GROUP ... lines (e.g. Java code , stack trace ) - select a style in the toolbar and then insert the text in the new created ...

 
issue

Strange Error with Criteria API and Sorting

We're creating a simple selection (distinct) including an order clause. When watching the created criteria in debugger we get the correct expression: SELECT DISTINCT $1 FROM MyEntity $1 WHERE ((TYPE($1)=class test.MyEntity)) ORDER BY UPPER($1.name) DESC You can see that in the order by there's correctly a "$1" var. Running this (without the type thing before) in the explorer correctly returns the sorted results. However, running this with the criteria API produces this error: ... in debugger we get the correct expression: SELECT DISTINCT $1 FROM MyEntity $1 WHERE ( ( TYPE ... ) ) ) ) ; query. select ( root ) . distinct ( true ) ; ...

 
tutorial

Step 3: Add a Context Listener Class

Explains how to add a servlet context listener (to manage an application scope EntityManagerFactory) in an Eclipse Web Application.... case sensitive class name. Click Next and then Select All to enable the Finish button. Click Finish to create ...

 
forum_thread

LEFT JOIN FETCH over empty embedded collection returns no results

First of all, thank you for promptly implementing JOIN FETCH over nested paths in response to my inquiry a few months ago. However, I have run into one problem: if an embedded collection is empty, but I attempt to LEFT JOIN FETCH all the members of a collection within a (non-existent) member of the first collection, the result of the overall query is an empty set. To use the example from my original post: @Embeddable class A { String val; };   ... the following works (returns my instance of C): SELECT c FROM C c LEFT JOIN FETCH c . bList WHERE id = ... fetch, it fails, returning an empty result list: SELECT c FROM C c LEFT JOIN FETCH c . bList LEFT JOIN ...

 
forum_thread

Criteria Query results in a NoResultException instead of returning object

When I run the following code    ... from ( identityClass ) ; criteria. select ( root ) ;   List<Predicate> predicates ... ; which evaluates to the query: SELECT $1 FROM IdentityObject $1 WHERE $1 . name = 'demo' ...

 
forum_thread

java.sql.Timestamp.getTime() not working

Hi, I need to work with Timestamp diff in two entity fields, but this queries SELECT count(p) FROM Player p WHERE p.loginAt.getTime()-p.registeredAt.getTime()>:value SELECT p.loginAt.getTime() FROM Player p fails with object is not an instance of declaring class but SELECT p.loginAt.getYear() FROM Player p works. How that possible?   ... diff in two entity fields, but this queries SELECT count ( p ) FROM Player p WHERE p . loginAt . ... . getTime ( ) > :value SELECT p . loginAt . getTime ( ) FROM Player p ...

 
manual

Index Definition

Describes how to define indexes in JPA entity classes and explains how indexes are used in JPQL queries.... efficient in lookup and range queries: SELECT p FROM Point p WHERE p . x = 100 SELECT p FROM Point p WHERE p . x BETWEEN 50 AND 80 ...

 
forum_thread

Explorer in 2.3

First, the new Explorer in ObjectDB is fantastic! This is exactly what we've needed - an easy way to do ad-hoc JPQL queries and navigate through the results and even make small changes to primitive data and Strings. After playing with it for a while, here is a list of additional features I'd love to have: 1. Export of selected data: a. Simple - Select a range of cells or a column header and copy text to the clipboard or save to a file (csv, html, etc..). (There appear to be copy menu options, but I cannot get them to work.) ... 1. Export of selected data: a. Simple - Select a range of cells or a column header and copy text to the clipboard or ... options, but I cannot get them to work.) b. XML - Select some objects and serialize them to XML (using ids for circular ...