JoSQL (Java Objects SQL) provides SQL capabilities for querying, ordering and grouping of collections of Java objects (POJOs). It allows a SQL statement to be applied to the collection of objects and the matching set returned, ordered and grouped.

See: http://josql.sourceforge.net


Version 1.2. provides the following enhancements:

* Introduction of sub-queries to query objects held in Collection/Map attributes of an object.

It is often useful to be able to perform a query on a collection of objects held in a Collection/Map attribute of an object, for example:

SELECT *
FROM MyObject
WHERE (SELECT *
        FROM myInnerList
        WHERE name LIKE '%me%')

This now means that the full object graph is available to query. Sub-queries can be used just about anywhere in a query, for example:

SELECT name,
       (SELECT *
        FROM myInnerList
        WHERE name LIKE '%me%')
FROM MyObject

Sub-queries can operate on Collections gained from accessors of the "parent" query, functions, bind variables and save values.
 

* Extended usage of "[*]" syntax.

It is now possible to use the "[*]" indicator on ANY column in a query (or sub-query). This allows the objects to be returned directly rather than in lists, one per result row.

For example:

SELECT [*] name,
       [*] otherName
FROM MyObject

Would return the "name" and "otherName" attributes in a single list.

This is most useful when dealing with sub-queries or anonymous queries such as:

SELECT *
FROM MyObject
WHERE primaryRefToOtherObject IN ((SELECT [*] refToOtherObject FROM otherObjects))


* Anonymous queries.

It is now possible to perform a query that does not specify the object type directly. This is most useful when dealing with sub-queries (perhaps if you want to "join" lists together).

For example:

SELECT [*] (SELECT *
            FROM ?
            WHERE name = 'bob'),
       [*] (SELECT *
            FROM ?
            WHERE name = 'bob')
FROM null

In this case the objects that have the name attribute equal to "bob" in the collections provided by the anonymous bind variables will be returned in a single list.


For full details of the changes see:

http://josql.sourceforge.net/manual/1-5.html