cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikita Timofeev (JIRA)" <>
Subject [jira] [Created] (CAY-2255) ObjectSelect improvement: columns as full entities
Date Mon, 06 Mar 2017 14:19:32 GMT
Nikita Timofeev created CAY-2255:

             Summary: ObjectSelect improvement: columns as full entities
                 Key: CAY-2255
             Project: Cayenne
          Issue Type: Improvement
          Components: Core Library
            Reporter: Nikita Timofeev
            Assignee: Nikita Timofeev

*Changes in API*:

# Add new Expression {{FullObjectExpression}} that will be just a marker for the desired logic.
  This expression can be later (_in post 4.0 versions_) used in {{where()}} and in {{orderBy()}}
methods to act as ObjectId and
  thus fill another gap where hacks like {{"db:OBJECT_ID"}} are used now.
# Add new factory methods in Property:
    <T extends Persistent> Property<T> createSelf(Class<? super T> type);
    <T extends Persistent> Property<T> createForRelationship(
                   Property<?> property, Class<? super T> type)
# Prohibit direct usage of Properties mapped on toMany relationships

*Usage examples*:

# Selecting root object plus some related fields:
Property<Artist> artistSelf = Property.createSelf(Artist.class);

List<Object[]> result = ObjectSelect.query(Artist.class)
        .columns(artistSelf, Artist.ARTIST_NAME, Artist.PAINTING_ARRAY.count())
# Selecting toOne relationship:
List<Object[]> result = ObjectSelect.query(Painting.class)
        .columns(Painting.PAINTING_TITLE, Painting.TO_ARTIST, Painting.TO_GALLERY)
# Selecting toMany relationship, the result will be as it will be in SQL query
Property<Artist> artist = Property.createSelf(Artist.class);
Property<Painting> artistPainting = Property.createForRelationship(Artist.PAINTING_ARRAY,
Property<Gallery> artistPaintingGallery =;

List<Object[]> result = ObjectSelect.query(Artist.class)
        .columns(artist, artistPainting, artistPaintingGallery)

This message was sent by Atlassian JIRA

View raw message