Class HqlQueryInfo
java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.utils.HqlQueryInfo
Represents information extracted from an HQL (Bibernate Query Language) query.
Parses the SELECT, JOIN FETCH, JOIN, and WHERE clauses to provide details about the HQL query.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringstatic final StringDot separator constant used in constructing entity aliases.private Stringprivate final Class<?> private Stringprivate static final PatternRegular expression pattern for extracting JOIN FETCH clauses from an HQL query.private static final PatternRegular expression pattern for extracting JOIN clauses from an HQL query.private static final PatternRegular expression pattern for extracting SELECT clause from an HQL query.private static final PatternRegular expression pattern for extracting WHERE clause from an HQL query. -
Constructor Summary
ConstructorsConstructorDescriptionHqlQueryInfo(String hqlQuery, Class<?> entityClass) Constructs an instance of HqlQueryInfo by parsing the provided HQL query and associating it with a specified entity class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFetchJoin(String fetchJoin) Adds a JOIN FETCH clause to the list of fetch joins.voidAdds a JOIN clause to the list of joins.voidsetConditions(String conditions) Sets the conditions obtained from the WHERE clause.voidsetEntityAlias(String entityAlias) Sets the entity alias obtained from the SELECT clause.voidsetEntityName(String entityName) Sets the entity name obtained from the SELECT clause.Converts the HQL query information into native SQL format based on the associated entity class.
-
Field Details
-
SELECT_PATTERN
Regular expression pattern for extracting SELECT clause from an HQL query. -
JOIN_FETCH_PATTERN
Regular expression pattern for extracting JOIN FETCH clauses from an HQL query. -
JOIN_PATTERN
Regular expression pattern for extracting JOIN clauses from an HQL query. -
WHERE_PATTERN
Regular expression pattern for extracting WHERE clause from an HQL query. -
DOT
Dot separator constant used in constructing entity aliases.- See Also:
-
entityName
-
entityAlias
-
conditions
-
joins
-
fetchJoins
-
entityClass
-
-
Constructor Details
-
HqlQueryInfo
Constructs an instance of HqlQueryInfo by parsing the provided HQL query and associating it with a specified entity class.- Parameters:
hqlQuery- The HQL query to be parsed.entityClass- The entity class associated with the HQL query.
-
-
Method Details
-
setEntityName
Sets the entity name obtained from the SELECT clause.- Parameters:
entityName- The entity name.
-
setEntityAlias
Sets the entity alias obtained from the SELECT clause.- Parameters:
entityAlias- The entity alias.
-
setConditions
Sets the conditions obtained from the WHERE clause.- Parameters:
conditions- The conditions.
-
addJoin
Adds a JOIN clause to the list of joins.- Parameters:
join- The JOIN clause.
-
addFetchJoin
Adds a JOIN FETCH clause to the list of fetch joins.- Parameters:
fetchJoin- The JOIN FETCH clause.
-
toNativeSql
Converts the HQL query information into native SQL format based on the associated entity class.- Returns:
- The native SQL representation of the HQL query information.
-