Class FlexibleRelationalPathBase<R>

  • Type Parameters:
    R - row ("entity bean") type - typically a pure DTO bean for the table mapped by Q-type
    All Implemented Interfaces:
    com.querydsl.core.types.EntityPath<R>, com.querydsl.core.types.Expression<R>, com.querydsl.core.types.Path<R>, com.querydsl.core.types.ProjectionRole<R>, com.querydsl.sql.RelationalPath<R>, Serializable

    public class FlexibleRelationalPathBase<R>
    extends com.querydsl.sql.RelationalPathBase<R>
    Extension of RelationalPathBase that adapts the Q-class to midPoint (mainly extension columns) while preserving all the features provided by Querydsl. The subclasses of this class for midPoint tables are written manually. The following procedure describes the migration from originally generated Querydsl class to the current state and while not used for newer classes can offer some answers: . Extend from this class instead of RelationalPathBase. . Extract constants for all column metadata from addMetadata(P, com.querydsl.sql.ColumnMetadata) method calls. Remove index information from them (column order, nothing to do with DB indexes). . Use Types.VARCHAR for text columns, never Types.NVARCHAR, the proper DB type will be used as needed (e.g. NVARCHAR for SQL Server). Types.NVARCHAR is not supported in PG driver at all and would cause problems. . Rename the column name to conform with SQL Server (if still relevant), because it is case-sensitive even about column names if *_CS_* collation is used! . Rewrite path fields so they use `create*()` methods from this super-class. . Now `addMetadata()` calls can be removed, including usages from constructors. . Prune constructors, two should be enough (see existing Q-classes). . Introduce `TABLE_NAME` constant - keep the names lowercase for MySQL (don't ask). . Rename path fields as needed (missing uppercase for words), also in related bean (M-class). . Unsuitable path types can be changed, e.g. date/time related. The same changes must be done for the related field in the M-class. Exotic type support can be added to Querydsl configuration (see usages of InstantType). . Remove default static final aliases, QueryTableMapping for the table will be responsible for providing aliases, including default ones. This better handles extension columns, static default alias would not easily know about them). . Simplify bean (M-class) to public fields with no setters/getters. . Add PK-based equals/hashCode to beans (not critical, but handy for grouping transformations). . Now it's time to create `@code QYourTypeMapping`, see any subclass of QueryTableMapping as example, then register the mapping with QueryModelMappingRegistry.register(javax.xml.namespace.QName, com.evolveum.midpoint.repo.sqlbase.mapping.QueryTableMapping<?, ?, ?>). The registration call typically appears in some bean configuration class.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String DEFAULT_SCHEMA_NAME  
      • Fields inherited from class com.querydsl.core.types.dsl.DslExpression

        hashCode, mixin
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected <P extends com.querydsl.core.types.Path<?>>
      P
      addMetadata​(P path, com.querydsl.sql.ColumnMetadata metadata)
      Works like default RelationalPathBase.addMetadata(Path, ColumnMetadata) and on top of it adds the information necessary to use dynamic/extension columns using methods like getPath(String).
      protected <E> com.querydsl.core.types.dsl.ArrayPath<E[],​E> createArray​(String property, Class<E[]> elementType, com.querydsl.sql.ColumnMetadata columnMetadata)  
      protected com.querydsl.core.types.dsl.BooleanPath createBoolean​(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates BooleanPath for a property and registers column metadata for it.
      protected com.querydsl.core.types.dsl.ArrayPath<byte[],​Byte> createByteArray​(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates byte array path for a property and registers column metadata for it.
      protected <A extends Comparable>
      com.querydsl.core.types.dsl.DateTimePath<A>
      createDateTime​(String property, Class<? super A> type, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates DateTimePath for a property and registers column metadata for it.
      protected <A extends Enum<A>>
      com.querydsl.core.types.dsl.EnumPath<A>
      createEnum​(String property, Class<A> type, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates EnumPath for a property and registers column metadata for it.
      protected com.querydsl.core.types.dsl.DateTimePath<Instant> createInstant​(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates DateTimePath for an Instant property and registers column metadata for it.
      protected com.querydsl.core.types.dsl.NumberPath<Integer> createInteger​(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates NumberPath for an Integer property and registers column metadata for it.
      protected com.querydsl.core.types.dsl.NumberPath<Long> createLong​(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates NumberPath for a Long property and registers column metadata for it.
      protected <A extends Number & Comparable<?>>
      com.querydsl.core.types.dsl.NumberPath<A>
      createNumber​(String property, Class<A> type, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates NumberPath for a number property and registers column metadata for it.
      com.querydsl.core.types.dsl.StringPath createString​(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates StringPath and for a property registers column metadata for it.
      protected UuidPath createUuid​(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
      Creates UuidPath path for a property and registers column metadata for it.
      @Nullable com.querydsl.core.types.Path<?> getPath​(@NotNull String propertyName)
      Returns Path expression by the property name.
      • Methods inherited from class com.querydsl.sql.RelationalPathBase

        add, all, count, countDistinct, createForeignKey, createForeignKey, createInvForeignKey, createInvForeignKey, createPrimaryKey, eq, eq, getColumns, getForeignKeys, getInverseForeignKeys, getMetadata, getPrimaryKey, getProjection, getSchemaAndTable, getSchemaName, getTableName, ne, ne
      • Methods inherited from class com.querydsl.core.types.dsl.BeanPath

        accept, as, createArray, createBoolean, createCollection, createComparable, createDate, createDateTime, createEnum, createList, createMap, createNumber, createSet, createSimple, createString, createTime, forProperty, getAnnotatedElement, getMetadata, getRoot, instanceOf, instanceOfAny
      • Methods inherited from class com.querydsl.core.types.dsl.SimpleExpression

        as, as, eqAll, eqAll, eqAny, eqAny, in, in, in, in, in, isNotNull, isNull, neAll, neAny, notIn, notIn, notIn, notIn, notIn, nullif, nullif, when, when
      • Methods inherited from class com.querydsl.core.types.dsl.DslExpression

        equals, getType, hashCode, toString
      • Methods inherited from interface com.querydsl.core.types.Expression

        accept, getType
      • Methods inherited from interface com.querydsl.core.types.Path

        getAnnotatedElement, getMetadata, getRoot
    • Constructor Detail

      • FlexibleRelationalPathBase

        public FlexibleRelationalPathBase​(Class<? extends R> type,
                                          String pathVariable,
                                          String schema,
                                          String table)
    • Method Detail

      • createNumber

        protected <A extends Number & Comparable<?>> com.querydsl.core.types.dsl.NumberPath<A> createNumber​(String property,
                                                                                                            Class<A> type,
                                                                                                            com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates NumberPath for a number property and registers column metadata for it.
      • createInteger

        protected com.querydsl.core.types.dsl.NumberPath<Integer> createInteger​(String property,
                                                                                com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates NumberPath for an Integer property and registers column metadata for it.
      • createLong

        protected com.querydsl.core.types.dsl.NumberPath<Long> createLong​(String property,
                                                                          com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates NumberPath for a Long property and registers column metadata for it.
      • createBoolean

        protected com.querydsl.core.types.dsl.BooleanPath createBoolean​(String property,
                                                                        com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates BooleanPath for a property and registers column metadata for it.
      • createString

        public com.querydsl.core.types.dsl.StringPath createString​(String property,
                                                                   com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates StringPath and for a property registers column metadata for it.
      • createEnum

        protected <A extends Enum<A>> com.querydsl.core.types.dsl.EnumPath<A> createEnum​(String property,
                                                                                         Class<A> type,
                                                                                         com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates EnumPath for a property and registers column metadata for it.
      • createDateTime

        protected <A extends Comparable> com.querydsl.core.types.dsl.DateTimePath<A> createDateTime​(String property,
                                                                                                    Class<? super A> type,
                                                                                                    com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates DateTimePath for a property and registers column metadata for it.
      • createInstant

        protected com.querydsl.core.types.dsl.DateTimePath<Instant> createInstant​(String property,
                                                                                  com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates DateTimePath for an Instant property and registers column metadata for it.
      • createByteArray

        protected com.querydsl.core.types.dsl.ArrayPath<byte[],​Byte> createByteArray​(String property,
                                                                                           com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates byte array path for a property and registers column metadata for it.
      • createArray

        protected <E> com.querydsl.core.types.dsl.ArrayPath<E[],​E> createArray​(String property,
                                                                                     Class<E[]> elementType,
                                                                                     com.querydsl.sql.ColumnMetadata columnMetadata)
      • createUuid

        protected UuidPath createUuid​(String property,
                                      com.querydsl.sql.ColumnMetadata columnMetadata)
        Creates UuidPath path for a property and registers column metadata for it.
      • addMetadata

        protected <P extends com.querydsl.core.types.Path<?>> P addMetadata​(P path,
                                                                            com.querydsl.sql.ColumnMetadata metadata)
        Works like default RelationalPathBase.addMetadata(Path, ColumnMetadata) and on top of it adds the information necessary to use dynamic/extension columns using methods like getPath(String).
        Overrides:
        addMetadata in class com.querydsl.sql.RelationalPathBase<R>
      • getPath

        @Nullable
        public @Nullable com.querydsl.core.types.Path<?> getPath​(@NotNull
                                                                 @NotNull String propertyName)
        Returns Path expression by the property name. This is useful for dynamic/extension columns that are not otherwise directly accessible.