Class FlexibleRelationalPathBase<R>
- java.lang.Object
-
- com.querydsl.core.types.dsl.DslExpression<T>
-
- com.querydsl.core.types.dsl.SimpleExpression<T>
-
- com.querydsl.core.types.dsl.BeanPath<T>
-
- com.querydsl.sql.RelationalPathBase<R>
-
- com.evolveum.midpoint.repo.sqlbase.querydsl.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 ofRelationalPathBase
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 ofRelationalPathBase
. . Extract constants for all column metadata fromaddMetadata(P, com.querydsl.sql.ColumnMetadata)
method calls. Remove index information from them (column order, nothing to do with DB indexes). . UseTypes.VARCHAR
for text columns, neverTypes.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 ofQueryTableMapping
as example, then register the mapping withQueryModelMappingRegistry.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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <P extends com.querydsl.core.types.Path<?>>
PaddMetadata(P path, com.querydsl.sql.ColumnMetadata metadata)
Works like defaultRelationalPathBase.addMetadata(Path, ColumnMetadata)
and on top of it adds the information necessary to use dynamic/extension columns using methods likegetPath(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)
CreatesBooleanPath
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)
CreatesDateTimePath
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)
CreatesEnumPath
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)
CreatesDateTimePath
for anInstant
property and registers column metadata for it.protected com.querydsl.core.types.dsl.NumberPath<Integer>
createInteger(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
CreatesNumberPath
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)
CreatesNumberPath
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)
CreatesNumberPath
for a number property and registers column metadata for it.com.querydsl.core.types.dsl.StringPath
createString(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
CreatesStringPath
and for a property registers column metadata for it.protected UuidPath
createUuid(String property, com.querydsl.sql.ColumnMetadata columnMetadata)
CreatesUuidPath
path for a property and registers column metadata for it.@Nullable com.querydsl.core.types.Path<?>
getPath(@NotNull String propertyName)
ReturnsPath
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
-
-
-
-
Field Detail
-
DEFAULT_SCHEMA_NAME
public static final String DEFAULT_SCHEMA_NAME
- See Also:
- Constant Field Values
-
-
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)
CreatesNumberPath
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)
CreatesNumberPath
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)
CreatesNumberPath
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)
CreatesBooleanPath
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)
CreatesStringPath
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)
CreatesEnumPath
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)
CreatesDateTimePath
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)
CreatesDateTimePath
for anInstant
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)
CreatesUuidPath
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 defaultRelationalPathBase.addMetadata(Path, ColumnMetadata)
and on top of it adds the information necessary to use dynamic/extension columns using methods likegetPath(String)
.- Overrides:
addMetadata
in classcom.querydsl.sql.RelationalPathBase<R>
-
getPath
@Nullable public @Nullable com.querydsl.core.types.Path<?> getPath(@NotNull @NotNull String propertyName)
ReturnsPath
expression by the property name. This is useful for dynamic/extension columns that are not otherwise directly accessible.
-
-