PersistenceUtils

This utility class provides methods for working with persistence-related operations, such as retrieving entity fields, finding entity types, determining attribute types, and performing other common tasks related to persistence.

Functions

Link copied to clipboard
fun findAttributeByPath(entityType: EntityType<*>, path: String): Attribute<*, *>

Finds an attribute by the given path in the provided entity type.

Link copied to clipboard
fun getEntityFields(metamodel: Metamodel, entityClass: Class<*>): Set<String>

Retrieves the set of field names for a given entity class from the metamodel.

Link copied to clipboard
fun getEntityType(metamodel: Metamodel, entityName: String): EntityType<*>?

Retrieves the entity type with the given name from the provided metamodel.

Link copied to clipboard
fun getIdAttributeName(entityType: EntityType<*>): String

Returns the name of the ID attribute for the given entity type.

Link copied to clipboard
fun getInverseAttribute(sourceEntityType: EntityType<*>, sourceAttribute: Attribute<*, *>, targetEntityType: EntityType<*>): Attribute<*, *>

Returns the inverse attribute for a given source attribute in a target entity.

Link copied to clipboard
fun getTargetEntityTypeForPluralAttribute(metamodel: Metamodel, attribute: Attribute<*, *>): EntityType<*>

Retrieves the target entity type for a plural attribute.

Link copied to clipboard
fun isBooleanType(attribute: Attribute<*, *>): Boolean

Determines if the given attribute is of boolean type.

Link copied to clipboard
fun isNumberType(attribute: Attribute<*, *>): Boolean

Checks if the given attribute is a number type.

Link copied to clipboard
fun isValidPath(entityType: EntityType<*>, path: String): Boolean

Checks if the given path is a valid path for the specified entity type.