Class EntityTypeProxy<ENTITY>

java.lang.Object
org.seasar.doma.jdbc.criteria.metamodel.EntityTypeProxy<ENTITY>
All Implemented Interfaces:
EntityType<ENTITY>

public class EntityTypeProxy<ENTITY> extends Object implements EntityType<ENTITY>
  • Constructor Details

  • Method Details

    • isImmutable

      public boolean isImmutable()
      Description copied from interface: EntityType
      Determines 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:
      isImmutable in interface EntityType<ENTITY>
      Returns:
      true if the entity is immutable, false otherwise
      See Also:
    • getName

      public String getName()
      Description copied from interface: EntityType
      Returns the name of this entity.

      The entity name typically corresponds to the simple name of the entity class, unless explicitly specified.

      Specified by:
      getName in interface EntityType<ENTITY>
      Returns:
      the entity name
    • getCatalogName

      public String getCatalogName()
      Description copied from interface: EntityType
      Returns 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:
      getCatalogName in interface EntityType<ENTITY>
      Returns:
      the database catalog name, or an empty string if not specified
      See Also:
    • getSchemaName

      public String getSchemaName()
      Description copied from interface: EntityType
      Returns 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:
      getSchemaName in interface EntityType<ENTITY>
      Returns:
      the database schema name, or an empty string if not specified
      See Also:
    • getTableName

      public String getTableName(BiFunction<NamingType,String,String> namingFunction)
      Description copied from interface: EntityType
      Returns 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:
      getTableName in interface EntityType<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: EntityType
      Returns 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:
      getQualifiedTableName in interface EntityType<ENTITY>
      Parameters:
      namingFunction - the function that applies naming convention to the table name
      quoteFunction - 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: EntityType
      Determines 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:
      isQuoteRequired in interface EntityType<ENTITY>
      Returns:
      true if quotation marks are required, false otherwise
      See Also:
    • getNamingType

      public NamingType getNamingType()
      Description copied from interface: EntityType
      Returns 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:
      getNamingType in interface EntityType<ENTITY>
      Returns:
      the naming convention type, or null if not specified
      See Also:
    • getGeneratedIdPropertyType

      public GeneratedIdPropertyType<ENTITY,?,?> getGeneratedIdPropertyType()
      Description copied from interface: EntityType
      Returns 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:
      getGeneratedIdPropertyType in interface EntityType<ENTITY>
      Returns:
      the generated identity property type, or null if none exists
      See Also:
    • getVersionPropertyType

      public VersionPropertyType<ENTITY,?,?> getVersionPropertyType()
      Description copied from interface: EntityType
      Returns 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:
      getVersionPropertyType in interface EntityType<ENTITY>
      Returns:
      the version property type, or null if none exists
      See Also:
    • getTenantIdPropertyType

      public TenantIdPropertyType<ENTITY,?,?> getTenantIdPropertyType()
      Description copied from interface: EntityType
      Returns 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:
      getTenantIdPropertyType in interface EntityType<ENTITY>
      Returns:
      the tenant identifier property type, or null if none exists
      See Also:
    • getIdPropertyTypes

      public List<EntityPropertyType<ENTITY,?>> getIdPropertyTypes()
      Description copied from interface: EntityType
      Returns 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:
      getIdPropertyTypes in interface EntityType<ENTITY>
      Returns:
      a list of primary key property types, or an empty list if none exist
      See Also:
    • getEntityPropertyType

      public EntityPropertyType<ENTITY,?> getEntityPropertyType(String __name)
      Description copied from interface: EntityType
      Returns 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:
      getEntityPropertyType in interface EntityType<ENTITY>
      Parameters:
      __name - the name of the property to look up
      Returns:
      the property type, or null if no property with the given name exists
      See Also:
    • getEntityPropertyTypes

      public List<EntityPropertyType<ENTITY,?>> getEntityPropertyTypes()
      Description copied from interface: EntityType
      Returns 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:
      getEntityPropertyTypes in interface EntityType<ENTITY>
      Returns:
      a list of all entity property types
      See Also:
    • newEntity

      public ENTITY newEntity(Map<String,Property<ENTITY,?>> __args)
      Description copied from interface: EntityType
      Creates 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:
      newEntity in interface EntityType<ENTITY>
      Parameters:
      __args - a map of property names to property values
      Returns:
      a new entity instance
    • getEntityClass

      public Class<ENTITY> getEntityClass()
      Description copied from interface: EntityType
      Returns 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:
      getEntityClass in interface EntityType<ENTITY>
      Returns:
      the entity class
    • saveCurrentStates

      public void saveCurrentStates(ENTITY entity)
      Description copied from interface: EntityType
      Saves 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:
      saveCurrentStates in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance whose state should be saved
      See Also:
    • getOriginalStates

      public ENTITY getOriginalStates(ENTITY entity)
      Description copied from interface: EntityType
      Returns 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:
      getOriginalStates in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance whose original state should be retrieved
      Returns:
      the original state of the entity, or null if no state was saved
      See Also:
    • preInsert

      public void preInsert(ENTITY entity, PreInsertContext<ENTITY> context)
      Description copied from interface: EntityType
      Called 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:
      preInsert in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance about to be inserted
      context - the context containing information about the insert operation
      See Also:
    • preUpdate

      public void preUpdate(ENTITY entity, PreUpdateContext<ENTITY> context)
      Description copied from interface: EntityType
      Called 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:
      preUpdate in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance about to be updated
      context - the context containing information about the update operation
      See Also:
    • preDelete

      public void preDelete(ENTITY entity, PreDeleteContext<ENTITY> context)
      Description copied from interface: EntityType
      Called 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:
      preDelete in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance about to be deleted
      context - the context containing information about the delete operation
      See Also:
    • postInsert

      public void postInsert(ENTITY entity, PostInsertContext<ENTITY> context)
      Description copied from interface: EntityType
      Called 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:
      postInsert in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance that was inserted
      context - the context containing information about the insert operation
      See Also:
    • postUpdate

      public void postUpdate(ENTITY entity, PostUpdateContext<ENTITY> context)
      Description copied from interface: EntityType
      Called 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:
      postUpdate in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance that was updated
      context - the context containing information about the update operation
      See Also:
    • postDelete

      public void postDelete(ENTITY entity, PostDeleteContext<ENTITY> context)
      Description copied from interface: EntityType
      Called 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:
      postDelete in interface EntityType<ENTITY>
      Parameters:
      entity - the entity instance that was deleted
      context - the context containing information about the delete operation
      See Also:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object