Class DelegatingJoinable

  • All Implemented Interfaces:
    java.io.Serializable, Joinable

    public class DelegatingJoinable
    extends java.lang.Object
    implements Joinable
    Delegates to another Joinable after doing column translation. Useful for joins that are not managed by any fields on the joined-from side. For example, a vertical class mapping manages foreign key columns linking to the superclass table. It needs to use the joinables of the superclass to actually extract the column values from field values and so forth, but in order for other mappings to join to its foreign key columns it needs joinables of its own. So it creates delegating joinables.
    Author:
    Abe White
    See Also:
    Serialized Form
    • Constructor Detail

      • DelegatingJoinable

        public DelegatingJoinable​(Joinable join,
                                  ForeignKey fk)
        Constructor.
        Parameters:
        join - the mapping to delegate to
        fk - the foreign key to use to translate any given columns to the given delegate's columns
      • DelegatingJoinable

        public DelegatingJoinable​(Joinable join,
                                  Column[] cols)
        Constructor.
        Parameters:
        join - the mapping to delegate to
        cols - translated columns
    • Method Detail

      • getFieldIndex

        public int getFieldIndex()
        Description copied from interface: Joinable
        Return the field index of this joinable, or -1 if not a field.
        Specified by:
        getFieldIndex in interface Joinable
      • getColumns

        public Column[] getColumns()
        Description copied from interface: Joinable
        The columns managed by this joinable.
        Specified by:
        getColumns in interface Joinable
      • getJoinValue

        public java.lang.Object getJoinValue​(java.lang.Object val,
                                             Column col,
                                             JDBCStore store)
        Description copied from interface: Joinable
        Return the join value of the given column.
        Specified by:
        getJoinValue in interface Joinable
        Parameters:
        val - the value of the field for this joinable
        col - the column of this joinable whose value to return
      • getJoinValue

        public java.lang.Object getJoinValue​(OpenJPAStateManager sm,
                                             Column col,
                                             JDBCStore store)
        Description copied from interface: Joinable
        Return the join value of the given column.
        Specified by:
        getJoinValue in interface Joinable
        Parameters:
        sm - the instance from which to get the value
        col - the column whose value to return