Class QueryTableMapping<S,​Q extends FlexibleRelationalPathBase<R>,​R>

    • Constructor Detail

      • QueryTableMapping

        protected QueryTableMapping​(@NotNull
                                    @NotNull String tableName,
                                    @NotNull
                                    @NotNull String defaultAliasName,
                                    @NotNull
                                    @NotNull Class<S> schemaType,
                                    @NotNull
                                    @NotNull Class<Q> queryType)
        Creates metamodel for the table described by designated type (Q-class) related to schema type. Allows registration of any number of columns - typically used for static properties (non-extensions).
        Parameters:
        tableName - database table name
        defaultAliasName - default alias name, some short abbreviation, must be unique across mapped types
    • Method Detail

      • stringMapper

        protected ItemSqlMapper stringMapper​(Function<com.querydsl.core.types.EntityPath<?>,​com.querydsl.core.types.dsl.StringPath> rootToQueryItem)
        Returns the mapper creating the string filter processor from context.
      • integerMapper

        public ItemSqlMapper integerMapper​(Function<com.querydsl.core.types.EntityPath<?>,​com.querydsl.core.types.dsl.NumberPath<Integer>> rootToQueryItem)
        Returns the mapper creating the integer filter processor from context.
      • timestampMapper

        protected <T extends Comparable<T>> ItemSqlMapper timestampMapper​(Function<com.querydsl.core.types.EntityPath<?>,​com.querydsl.core.types.dsl.DateTimePath<T>> rootToQueryItem)
        Returns the mapper function creating the timestamp filter processor from context.
      • addDetailFetchMapper

        public final void addDetailFetchMapper​(ItemName itemName,
                                               SqlDetailFetchMapper<R,​?,​?,​?> detailFetchMapper)
        Fetcher/mappers for detail tables take care of loading to-many details related to this mapped entity (master). One fetcher per detail type/table is registered under the related item name.
        Parameters:
        itemName - item name from schema type that is mapped to detail table in the repository
        detailFetchMapper - fetcher-mapper that handles loading of details
        See Also:
        SqlDetailFetchMapper
      • path

        protected <A extends com.querydsl.core.types.Path<?>> Function<com.querydsl.core.types.EntityPath<?>,​A> path​(Function<Q,​A> rootToQueryItem)
        Lambda "wrapper" that helps with type inference when mapping paths from entity path.
      • path

        protected <OQ extends com.querydsl.core.types.EntityPath<OR>,​OR,​A extends com.querydsl.core.types.Path<?>> Function<com.querydsl.core.types.EntityPath<?>,​A> path​(Class<OQ> queryType,
                                                                                                                                                                                            Function<OQ,​A> entityToQueryItem)
        Lambda "wrapper" but this time with explicit query type (otherwise unused by the method) for paths not starting on the Q parameter used for this mapping instance.
      • joinOn

        protected <DQ extends com.querydsl.core.types.EntityPath<DR>,​DR> BiFunction<Q,​DQ,​com.querydsl.core.types.Predicate> joinOn​(BiFunction<Q,​DQ,​com.querydsl.core.types.Predicate> joinOnPredicateFunction)
        Lambda "wrapper" that helps with the type inference (namely the current Q type). Returned bi-function returns ON condition predicate for two entity paths.
      • tableName

        public String tableName()
      • defaultAliasName

        public String defaultAliasName()
      • newAlias

        public Q newAlias​(String alias)
        Creates new alias (entity path instance) with a defined name. You can also use defaultAlias() if one alias in a query is enough. Entity path instance returned by this call is already enhanced by extension columns.
      • newAliasInstance

        protected abstract Q newAliasInstance​(String alias)
        Method returning new instance of EntityPath - to be implemented by sub-mapping. This will create entity path without any extension columns, see newAlias(java.lang.String) for that.
      • defaultAlias

        public Q defaultAlias()
        Returns default alias - use only once per query, e.g. not for two different joins. Also, don't cache it yourself, always use this method which ensures that the alias has all the extension columns configured properly.
      • createTransformer

        public SqlTransformer<S,​Q,​R> createTransformer​(SqlTransformerSupport transformerSupport)
        Creates SqlTransformer of row bean to schema type, override if provided. TODO: rethink/confirm this create mechanism, currently the SqlTransformerSupport is managed component without any other state and so are transformers, perhaps we can pre-create them or cache (I don't like the sound of that). On the other hand they are really lightweight and short lived helpers too, so it shouldn't be a real GC problem.
      • addExtensionColumn

        public void addExtensionColumn​(String propertyName,
                                       com.querydsl.sql.ColumnMetadata columnMetadata)
        Registers extension columns. At this moment all are treated as strings.
      • getExtensionColumns

        public Map<String,​com.querydsl.sql.ColumnMetadata> getExtensionColumns()
      • selectExpressionsWithCustomColumns

        @NotNull
        public @NotNull com.querydsl.core.types.Path<?>[] selectExpressionsWithCustomColumns​(Q entity)
      • newRowObject

        public R newRowObject()