Class EntityTypeProxy<ENTITY>
- All Implemented Interfaces:
EntityType<ENTITY>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the database catalog name for this entity.Returns the Java Class object for this entity type.getEntityPropertyType(String __name) Returns the property type for a specific property by name.Returns a list of all property types defined for this entity.Returns the property type for the generated identity (primary key) property.Returns a list of property types for all primary key properties in this entity.getName()Returns the name of this entity.Returns the naming convention type used for this entity.getOriginalStates(ENTITY entity) Returns the original state of an entity that was previously saved.getQualifiedTableName(BiFunction<NamingType, String, String> namingFunction, Function<String, String> quoteFunction) Returns the fully qualified database table name for this entity.Returns the database schema name for this entity.getTableName(BiFunction<NamingType, String, String> namingFunction) Returns the database table name for this entity with naming convention applied.Returns the property type for the tenant identifier property used for multi-tenancy.Returns the property type for the version property used for optimistic locking.inthashCode()booleanDetermines whether the entity class is immutable.booleanDetermines whether quotation marks are required for catalog, schema, and table names.Creates a new instance of the entity class.voidpostDelete(ENTITY entity, PostDeleteContext<ENTITY> context) Called after an entity has been successfully deleted from the database.voidpostInsert(ENTITY entity, PostInsertContext<ENTITY> context) Called after an entity has been successfully inserted into the database.voidpostUpdate(ENTITY entity, PostUpdateContext<ENTITY> context) Called after an entity has been successfully updated in the database.voidpreDelete(ENTITY entity, PreDeleteContext<ENTITY> context) Called before an entity is deleted from the database.voidpreInsert(ENTITY entity, PreInsertContext<ENTITY> context) Called before an entity is inserted into the database.voidpreUpdate(ENTITY entity, PreUpdateContext<ENTITY> context) Called before an entity is updated in the database.voidsaveCurrentStates(ENTITY entity) Saves the current state of an entity for later comparison.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.seasar.doma.jdbc.entity.EntityType
getAssociationPropertyTypes
-
Constructor Details
-
EntityTypeProxy
-
-
Method Details
-
isImmutable
public boolean isImmutable()Description copied from interface:EntityTypeDetermines whether the entity class is immutable.An immutable entity has all its properties set through its constructor and provides no setters to modify its state after creation. Immutable entities are typically implemented using final fields.
- Specified by:
isImmutablein interfaceEntityType<ENTITY>- Returns:
trueif the entity is immutable,falseotherwise- See Also:
-
getName
Description copied from interface:EntityTypeReturns the name of this entity.The entity name typically corresponds to the simple name of the entity class, unless explicitly specified.
- Specified by:
getNamein interfaceEntityType<ENTITY>- Returns:
- the entity name
-
getCatalogName
Description copied from interface:EntityTypeReturns the database catalog name for this entity.The catalog name is determined based on the
Table.catalog()attribute if present, or may be empty if not specified.- Specified by:
getCatalogNamein interfaceEntityType<ENTITY>- Returns:
- the database catalog name, or an empty string if not specified
- See Also:
-
getSchemaName
Description copied from interface:EntityTypeReturns the database schema name for this entity.The schema name is determined based on the
Table.schema()attribute if present, or may be empty if not specified.- Specified by:
getSchemaNamein interfaceEntityType<ENTITY>- Returns:
- the database schema name, or an empty string if not specified
- See Also:
-
getTableName
Description copied from interface:EntityTypeReturns the database table name for this entity with naming convention applied.The table name is determined based on the
Table.name()attribute if present, or derived from the entity name using the specified naming convention function.- Specified by:
getTableNamein interfaceEntityType<ENTITY>- Parameters:
namingFunction- the function that applies naming convention to the table name- Returns:
- the database table name with naming convention applied
- See Also:
-
getQualifiedTableName
public String getQualifiedTableName(BiFunction<NamingType, String, String> namingFunction, Function<String, String> quoteFunction) Description copied from interface:EntityTypeReturns the fully qualified database table name for this entity.The qualified table name includes the catalog and schema names if specified, with both naming convention and quotation marks applied as needed.
- Specified by:
getQualifiedTableNamein interfaceEntityType<ENTITY>- Parameters:
namingFunction- the function that applies naming convention to the table namequoteFunction- the function that applies quotation marks to the table name- Returns:
- the fully qualified table name (catalog.schema.table)
- See Also:
-
isQuoteRequired
public boolean isQuoteRequired()Description copied from interface:EntityTypeDetermines whether quotation marks are required for catalog, schema, and table names.This method indicates if the catalog, schema, and table names should be quoted in SQL statements, which is typically needed for reserved words or names with special characters.
- Specified by:
isQuoteRequiredin interfaceEntityType<ENTITY>- Returns:
trueif quotation marks are required,falseotherwise- See Also:
-
getNamingType
Description copied from interface:EntityTypeReturns the naming convention type used for this entity.The naming convention determines how entity and property names are converted to table and column names when not explicitly specified.
- Specified by:
getNamingTypein interfaceEntityType<ENTITY>- Returns:
- the naming convention type, or
nullif not specified - See Also:
-
getGeneratedIdPropertyType
Description copied from interface:EntityTypeReturns the property type for the generated identity (primary key) property.This method returns the property type for a primary key property that has its value automatically generated, such as an auto-increment column or a sequence-generated value.
- Specified by:
getGeneratedIdPropertyTypein interfaceEntityType<ENTITY>- Returns:
- the generated identity property type, or
nullif none exists - See Also:
-
getVersionPropertyType
Description copied from interface:EntityTypeReturns the property type for the version property used for optimistic locking.This method returns the property type for a version property that is automatically incremented during update operations to implement optimistic concurrency control.
- Specified by:
getVersionPropertyTypein interfaceEntityType<ENTITY>- Returns:
- the version property type, or
nullif none exists - See Also:
-
getTenantIdPropertyType
Description copied from interface:EntityTypeReturns the property type for the tenant identifier property used for multi-tenancy.This method returns the property type for a tenant identifier property that is used to implement multi-tenant database access, where a single database instance serves multiple logical tenants.
- Specified by:
getTenantIdPropertyTypein interfaceEntityType<ENTITY>- Returns:
- the tenant identifier property type, or
nullif none exists - See Also:
-
getIdPropertyTypes
Description copied from interface:EntityTypeReturns a list of property types for all primary key properties in this entity.This method returns property types for all properties annotated with
Id, which mark them as primary key columns in the database table.- Specified by:
getIdPropertyTypesin interfaceEntityType<ENTITY>- Returns:
- a list of primary key property types, or an empty list if none exist
- See Also:
-
getEntityPropertyType
Description copied from interface:EntityTypeReturns the property type for a specific property by name.This method allows looking up a property type by its name, which is useful for dynamic property access and metadata inspection.
- Specified by:
getEntityPropertyTypein interfaceEntityType<ENTITY>- Parameters:
__name- the name of the property to look up- Returns:
- the property type, or
nullif no property with the given name exists - See Also:
-
getEntityPropertyTypes
Description copied from interface:EntityTypeReturns a list of all property types defined for this entity.This method returns property types for all properties in the entity class, including regular properties, ID properties, version properties, and tenant ID properties.
- Specified by:
getEntityPropertyTypesin interfaceEntityType<ENTITY>- Returns:
- a list of all entity property types
- See Also:
-
newEntity
Description copied from interface:EntityTypeCreates a new instance of the entity class.This method instantiates a new entity instance using the provided property values. It is typically used by the framework to create entity instances from database query results.
- Specified by:
newEntityin interfaceEntityType<ENTITY>- Parameters:
__args- a map of property names to property values- Returns:
- a new entity instance
-
getEntityClass
Description copied from interface:EntityTypeReturns the Java Class object for this entity type.This method returns the Class object that represents the entity class this EntityType describes. It can be used for reflection operations or type checking.
- Specified by:
getEntityClassin interfaceEntityType<ENTITY>- Returns:
- the entity class
-
saveCurrentStates
Description copied from interface:EntityTypeSaves the current state of an entity for later comparison.This method is used to implement optimistic concurrency control and dirty property detection. It stores the current state of the entity so that it can be compared with future states to determine what has changed.
- Specified by:
saveCurrentStatesin interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance whose state should be saved- See Also:
-
getOriginalStates
Description copied from interface:EntityTypeReturns the original state of an entity that was previously saved.This method retrieves the original state of an entity that was previously saved using
EntityType.saveCurrentStates(Object). It is used to implement optimistic concurrency control and dirty property detection by comparing the current state with the original state.- Specified by:
getOriginalStatesin interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance whose original state should be retrieved- Returns:
- the original state of the entity, or
nullif no state was saved - See Also:
-
preInsert
Description copied from interface:EntityTypeCalled before an entity is inserted into the database.This method delegates to the appropriate entity listener's preInsert method to implement pre-insert logic such as setting creation timestamps, generating IDs, or validating entity state.
- Specified by:
preInsertin interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance about to be insertedcontext- the context containing information about the insert operation- See Also:
-
preUpdate
Description copied from interface:EntityTypeCalled before an entity is updated in the database.This method delegates to the appropriate entity listener's preUpdate method to implement pre-update logic such as setting modification timestamps, validating entity state, or implementing business rules.
- Specified by:
preUpdatein interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance about to be updatedcontext- the context containing information about the update operation- See Also:
-
preDelete
Description copied from interface:EntityTypeCalled before an entity is deleted from the database.This method delegates to the appropriate entity listener's preDelete method to implement pre-delete logic such as validating that the entity can be deleted, logging deletion attempts, or implementing business rules.
- Specified by:
preDeletein interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance about to be deletedcontext- the context containing information about the delete operation- See Also:
-
postInsert
Description copied from interface:EntityTypeCalled after an entity has been successfully inserted into the database.This method delegates to the appropriate entity listener's postInsert method to implement post-insert logic such as processing generated IDs, triggering related operations, or performing additional validations.
- Specified by:
postInsertin interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance that was insertedcontext- the context containing information about the insert operation- See Also:
-
postUpdate
Description copied from interface:EntityTypeCalled after an entity has been successfully updated in the database.This method delegates to the appropriate entity listener's postUpdate method to implement post-update logic such as triggering related operations, performing additional validations, or executing business logic.
- Specified by:
postUpdatein interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance that was updatedcontext- the context containing information about the update operation- See Also:
-
postDelete
Description copied from interface:EntityTypeCalled after an entity has been successfully deleted from the database.This method delegates to the appropriate entity listener's postDelete method to implement post-delete logic such as cleaning up related resources, triggering cascading operations, or logging successful deletions.
- Specified by:
postDeletein interfaceEntityType<ENTITY>- Parameters:
entity- the entity instance that was deletedcontext- the context containing information about the delete operation- See Also:
-
equals
-
hashCode
public int hashCode()
-