Guide to 4.2 Features
1. Java Version
Minimum required JDK version is 1.8 or newer. Cayenne 4.2 is fully tested with Java 1.8 and 11.
2. New Features
2.1. Subqueries
Expressions are now support subqueries.
ColumnSelect<Long> subQuery = ObjectSelect
.columnQuery(Artist.class, Artist.ARTIST_ID_PK_PROPERTY)
.where(...);
List<Artist> artists = ObjectSelect.query(Artist.class)
.where(Artist.ARTIST_ID_PK_PROPERTY.in(subQuery))
.select(context);
2.2. New Property API
Property API are greatly revised. This API allows to use type aware expression factories aka Properties. These properties are normally generated as static constants in model classes, but they can also be created manually by PropertyFactory
if needed.
Typical usage in select queries:
Painting painting = //...
Artist artist = ObjectSelect.query(Artist.class)
.where(Artist.PAINTING_ARRAY.contains(painting))
.and(Artist.DATE_OF_BIRTH.year().gt(1950))
.and(Artist.ARTIST_NAME.lower().like("pablo%"))
.selectOne(context);