java.lang.Object
org.seasar.doma.jdbc.query.UpsertAssemblerSupport
Support class for assembling UPSERT SQL statements. Provides utilities for handling table and
column names with different formatting options.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum representing different ways to format column names in SQL statements.static classDefault implementation of UpsertAliasConstants that provides standard alias names.static enumEnum representing different ways to format table names in SQL statements.static interfaceInterface defining constants for table aliases used in UPSERT statements. -
Constructor Summary
ConstructorsConstructorDescriptionUpsertAssemblerSupport(Naming naming, Dialect dialect) Creates a new instance with default alias constants.UpsertAssemblerSupport(Naming naming, Dialect dialect, UpsertAssemblerSupport.UpsertAliasConstants aliasConstants) Creates a new instance with the specified alias constants. -
Method Summary
Modifier and TypeMethodDescriptionGets the alias for the excluded table.excludeProp(EntityPropertyType<?, ?> propertyType, UpsertAssemblerSupport.ColumnNameType columnNameType) Formats a property name for the excluded table based on the specified property type and column name type.InParameter<?>param(EntityPropertyType<?, ?> propertyType, Map<EntityPropertyType<?, ?>, InParameter<?>> values) Gets the input parameter for the specified property type from the values map.prop(EntityPropertyType<?, ?> propertyType) Gets the column name for the specified property type.targetProp(EntityPropertyType<?, ?> propertyType, UpsertAssemblerSupport.ColumnNameType columnNameType) Formats a property name for the target table based on the specified property type and column name type.targetTable(List<EntityPropertyType<?, ?>> entityPropertyTypes, UpsertAssemblerSupport.TableNameType tableNameType) Formats a table name based on the specified entity property types and table name type.targetTable(EntityType<?> entityType, UpsertAssemblerSupport.TableNameType tableNameType) Formats a table name based on the specified entity type and table name type.
-
Constructor Details
-
UpsertAssemblerSupport
Creates a new instance with default alias constants.- Parameters:
naming- the naming conventiondialect- the SQL dialect
-
UpsertAssemblerSupport
public UpsertAssemblerSupport(Naming naming, Dialect dialect, UpsertAssemblerSupport.UpsertAliasConstants aliasConstants) Creates a new instance with the specified alias constants.- Parameters:
naming- the naming conventiondialect- the SQL dialectaliasConstants- the constants for table aliases
-
-
Method Details
-
targetTable
public String targetTable(EntityType<?> entityType, UpsertAssemblerSupport.TableNameType tableNameType) Formats a table name based on the specified entity type and table name type.- Parameters:
entityType- the entity typetableNameType- the table name formatting type- Returns:
- the formatted table name
- Throws:
IllegalArgumentException- if the table name type is unknown
-
targetTable
public String targetTable(List<EntityPropertyType<?, ?>> entityPropertyTypes, UpsertAssemblerSupport.TableNameType tableNameType) Formats a table name based on the specified entity property types and table name type.- Parameters:
entityPropertyTypes- the entity property typestableNameType- the table name formatting type- Returns:
- the formatted table name
- Throws:
UnsupportedOperationException- if the table name type is NAME or NAME_ALIASIllegalArgumentException- if the table name type is unknown
-
targetProp
public String targetProp(EntityPropertyType<?, ?> propertyType, UpsertAssemblerSupport.ColumnNameType columnNameType) Formats a property name for the target table based on the specified property type and column name type.- Parameters:
propertyType- the entity property typecolumnNameType- the column name formatting type- Returns:
- the formatted property name
- Throws:
IllegalArgumentException- if the column name type is unknown
-
excludeAlias
Gets the alias for the excluded table.- Returns:
- the excluded table alias
-
excludeProp
public String excludeProp(EntityPropertyType<?, ?> propertyType, UpsertAssemblerSupport.ColumnNameType columnNameType) Formats a property name for the excluded table based on the specified property type and column name type.- Parameters:
propertyType- the entity property typecolumnNameType- the column name formatting type- Returns:
- the formatted property name
- Throws:
IllegalArgumentException- if the column name type is unknown
-
prop
Gets the column name for the specified property type.- Parameters:
propertyType- the entity property type- Returns:
- the column name
-
param
public InParameter<?> param(EntityPropertyType<?, ?> propertyType, Map<EntityPropertyType<?, ?>, InParameter<?>> values) Gets the input parameter for the specified property type from the values map.- Parameters:
propertyType- the entity property typevalues- the map of property types to input parameters- Returns:
- the input parameter for the property type, or null if not found
-