About SELECT

forum_thread

How do I achieve a Deep Fetch using JOIN FETCH?

I have an Entity type which is contains a collection of Embeddable objects, which in turn themselves contain a collection of Embeddable objects: @Embeddable class A { String val; }; @Embeddable class B { List<A> aList; }; @Entity class C { @Id long id; List<B> bList; };   Usually I'm content to have the B's and A's be lazily loaded, but I have a circumstance where I need to be able to work with the whole C object, with all its parts, as a detached object. ... one level of eager fetch in JPQL as follows: SELECT c FROM C JOIN FETCH c . bList WHERE c . id = :id ... But when I attempt to take it to the 2nd level: SELECT c FROM C JOIN FETCH c . bList JOIN FETCH c . ...

 
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! ... exist in a provided list? e.g. something like: SELECT u FROM User m WHERE u . username IN ( ... query = em. createQuery ( "SELECT e.name FROM MyEntity e WHERE e.name MEMBER OF :names" ) ; ...

 
forum_thread

com.objectdb.o.NLV cannot be cast to com.objectdb.o.RSV

Hello! This query is working fine SELECT DISTINCT $1 FROM ChatHistoryItem $1 JOIN $1.recipient $2 JOIN $1.sender $3 WHERE ($2.id='22afeafe-363f-4397-8553-cc5688ba142d') OR ($3.id='22afeafe-363f-4397-8553-cc5688ba142d')  ORDER BY MAX($1.createDate) DESC   but this query returns an exception "com.objectdb.o.NLV cannot be cast to com.objectdb.o.RSV" SELECT DISTINCT $1 FROM ChatHistoryItem $1 JOIN $1.recipient $2  ... Hello! This query is working fine SELECT DISTINCT $1   FROM ChatHistoryItem $1 JOIN $1 . ... cannot be cast to com.objectdb.o.RSV" SELECT DISTINCT $1   FROM ChatHistoryItem $1 JOIN $1 . ...

 
forum_thread

Searching lists within objects

Hi everyone,  I've a problem with searching on lists. I'm uncertain as to what the best form is, so I've created a maven project with all the classes and a unit test showing my issue. Pretty much I want to search using cb.isMember passing an object. This however does NOT work. I'm uncertain how the database is doing its matching, but it looks to me like it matches using objectids, which means you can only match isMember if you have a database object. This does not help as I'm never going to have the real object at search time. ... ) ) ;   q. select ( cdi ) . where ( pred ) ; ... true ) ;   String query = "SELECT DISTINCT t FROM com.contextspace.datamodel.party.CDI t JOIN ...

 
forum_thread

Using the wrong class to access a database

Hello, just starting to test ObjectDB and ran into a problem. I've created a small program to test the Point database described in the Getting Started section: ... 1 Query q1 = em. createQuery ( "SELECT COUNT(p) FROM Point p" ) ; System. out . println ... 2 Query q2 = em. createQuery ( "SELECT AVG(p.x) FROM Point p" ) ; System. out . println ...

 
forum_thread

Error using query with MAX() function

I have a class that is persisting a Entity that holds remarks and a time. Then when I query for the latest remark I get a internal error when the remark is larger than 1966 chars. Here is a test class and entity that reproduces the problem on my system. ... ) ; CriteriaQuery<Object> s = q. select ( me ) ;   Predicate predicate = ... 21:10:36 #150 query.manager] <queryRequest query="SELECT MAX($1.addDate) FROM Notes $1 WHERE $1.addDate IS NOT NULL" args="null" ...

 
issue

Different behavior for casting and not casting

Hi, Please use attached db for testing the queries. Query #1 which works and selects a few entities: SELECT DISTINCT $1 FROM com.lexware.vereinsverwaltung.verein.mitglied.Mitglied $1 WHERE $1.qubletFRAGMENTMAP.get('com.lexware.vereinsverwaltung.abrechnung.api.model.mitglied.MitgliedVertraegeFragment') IS NOT NULL Query #2 which is equal to the previous one though includes a casting and returns NO entities: ... Query #1 which works and selects a few entities: SELECT DISTINCT $1 FROM com . lexware . vereinsverwaltung . ... includes a casting and returns NO entities: SELECT DISTINCT $1 FROM com . lexware . vereinsverwaltung . ...

 
forum_thread

JPQL query to get entities that does not have a child entity in their child entities

I have 2 tables as shown below. Job Table ID JobId Name StartTime    FinishTime    .... 01 001   A  2105:12:10 14:00:00  2105:12:10 14:00:10 02    002  A  2105:12:10 14:00:00  2105:12:10 14:00:00 03    003  A  2105:12:10 14:00:00  2105:12:10 14:00:00 04    004  A  2105:12:10 14:00:00  2105:12:10 14:00:00 And ... , query = "SELECT J FROM JobEntity J, IN(J.statuses) JS WHERE " + "J.startTime ... , query = "SELECT J FROM JobEntity J, IN(J.statuses) JS WHERE " + "J.startTime ... , query = "SELECT J FROM JobEntity J, IN(J.statuses) JS WHERE " + "J.startTime ...

 
issue

[ObjectDB 2.5.5_03] Unexpected exception (Error 990)

Hello! When I run this query SELECT t FROM Unit t WHERE t.lastGeocodedPosition IS NULL OR t.lastGeocodedPosition.receiveTime < :lastGeocodedPosition.receiveTime I get the following exception: ... Hello! When I run this query SELECT t FROM Unit t WHERE t . lastGeocodedPosition IS NULL ... of course). Try the following query: SELECT t FROM Unit t WHERE t . lastGeocodedPosition IS NULL ...

 
forum_thread

Possible issue for JPQL "LEFT [OUTER] JOIN"

Possible issue for JPQL "LEFT [OUTER] JOIN" is doing "[INNER] JOIN".   Thanks. ... following JPQL queries string:     - "SELECT a,b FROM A a LEFT OUTER JOIN a.listB b WHERE b IS NULL" where the ... is only for single-valued field.     - "SELECT a,b FROM A a LEFT OUTER JOIN a.listB b WHERE b.id IS NULL" but ...