You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (Jira)" <ji...@apache.org> on 2022/09/08 09:55:00 UTC

[jira] [Created] (CAY-2759) Add utility methods to the SELF property

Nikita Timofeev created CAY-2759:
------------------------------------

             Summary: Add utility methods to the SELF property
                 Key: CAY-2759
                 URL: https://issues.apache.org/jira/browse/CAY-2759
             Project: Cayenne
          Issue Type: Improvement
          Components: Core Library
            Reporter: Nikita Timofeev
            Assignee: Nikita Timofeev
             Fix For: 4.3.M1


After CAY-2754 is done we have SELF property generated for the entities.
We could make it a separate type rather than {{EntityProperty}} and add some convenience methods to it.
Here's what I already played with:
{code}
// query() method to create ObjectSelect
List<Artist> artistList = Artist.SELF.query().select(context);
// same with a where clause
Artist artistById = Artist.SELF.query(Artist.SELF.eqId(1)).selectOne(context);
// shortcut for a EXISTS/NOT EXISTS subquery 
long count = Artist.SELF.query(Painting.SELF.notExists(Painting.TO_ARTIST.eq(Artist.SELF.enclosing()))).selectCount(context);
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)