org.apache.cayenne.exp.property

## Class EntityProperty<E extends Persistent>

- java.lang.Object
- - org.apache.cayenne.exp.property.BaseProperty<E>
  - - org.apache.cayenne.exp.property.EntityProperty<E>

- All Implemented Interfaces:
    PathProperty<E>, Property<E>, RelationshipProperty<E>

      public class EntityProperty<E extends Persistent>
      extends BaseProperty<E>
      implements RelationshipProperty<E>

  Property that represents to-one relationships.

  Usage examples in where clause:

       ObjectSelect.query(Paintings.class)
            .where(Painting.TO_ARTIST.dot(Artist.ARTIST_NAME).eq("Pablo Picasso"));

  Usage examples in column select, in this case full Artist entity will be returned in the result:

       ObjectSelect
            .columnQuery(Paintings.class, Painting.PAINTING_TITLE, Painting.TO_ARTIST);

  Since:
    4.2
  See Also:
    `org.apache.cayenne.exp.property`

- - ### Field Summary

    - ### Fields inherited from class org.apache.cayenne.exp.property.BaseProperty

      `expressionSupplier, name, type`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `EntityProperty(String name, Expression expression, Class<E> type)` Constructs a new property with the given name and expression

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `EntityProperty<E>` | `alias(String alias)` Creates alias with different name for this property
    `EntityProperty<E>` | `enclosing()`
    `Expression` | `eqId(Object id)`
    `Expression` | `inId(Collection<Object> ids)`
    `Expression` | `inId(Object firstId, Object... moreIds)`
    `Expression` | `neqId(Object id)`
    `Expression` | `ninId(Collection<Object> ids)`
    `Expression` | `ninId(Object firstId, Object... moreIds)`
    `EntityProperty<E>` | `outer()` Returns a version of this property that represents an OUTER join.

    - ### Methods inherited from class org.apache.cayenne.exp.property.BaseProperty

      `asc, ascInsensitive, ascInsensitives, ascs, count, countDistinct, desc, descInsensitive, descInsensitives, descs, eq, eq, equals, function, function, getAlias, getExpression, getFrom, getFromAll, getName, getType, hashCode, in, in, in, isFalse, isNotNull, isNull, isTrue, ne, ne, nin, nin, nin, operator, operator, path, setIn, setInAll`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.cayenne.exp.property.RelationshipProperty

      `disjoint, disjointById, dot, dot, dot, dot, dot, dot, dot, joint`

    - ### Methods inherited from interface org.apache.cayenne.exp.property.PathProperty

      `dot, dot, dot, dot, dot`

    - ### Methods inherited from interface org.apache.cayenne.exp.property.Property

      `getAlias, getExpression, getName, getType`

- - ### Constructor Detail

    - #### EntityProperty

          protected EntityProperty(String name,
                                   Expression expression,
                                   Class<E> type)

      Constructs a new property with the given name and expression
      Parameters:
        `name` - of the property (will be used as alias for the expression)
        `expression` - expression for property
        `type` - of the property
      See Also:
        `PropertyFactory.createBase(String, Expression, Class)`

  - ### Method Detail

    - #### eqId

          public Expression eqId(Object id)

    - #### inId

          public Expression inId(Collection<Object> ids)

    - #### inId

          public Expression inId(Object firstId,
                                 Object... moreIds)

    - #### neqId

          public Expression neqId(Object id)

    - #### ninId

          public Expression ninId(Collection<Object> ids)

    - #### ninId

          public Expression ninId(Object firstId,
                                  Object... moreIds)

    - #### alias

          public EntityProperty<E> alias(String alias)

      Creates alias with different name for this property
      Overrides:
        `alias` in class `BaseProperty<E extends Persistent>`

    - #### outer

          public EntityProperty<E> outer()

      Returns a version of this property that represents an OUTER join. It is up to caller to ensure that the property corresponds to a relationship, as "outer" attributes make no sense.
      Specified by:
        `outer` in interface `RelationshipProperty<E extends Persistent>`

    - #### enclosing

          public EntityProperty<E> enclosing()

      Overrides:
        `enclosing` in class `BaseProperty<E extends Persistent>`
      Returns:
        property that will be translated relative to parent query

Copyright © 2001–2021 Apache Cayenne. All rights reserved.