Class PostgresIdentity
java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.jdbc.identity.PostgresIdentity
- All Implemented Interfaces:
Identity
Implementation of the Identity interface for managing identity-related operations
in Bibernate application specific to PostgreSQL databases.
It delegates entity-saving operations to different generators based on the GenerationType strategy
specified in the entities' annotations.
Supports NONE, SEQUENCE, and IDENTITY GenerationType strategies.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
Modifier and TypeFieldDescriptionprivate final BibernateDatabaseSettings
The settings for Bibernate database interactions.List of generators for handling different GenerationType strategies. -
Constructor Summary
ConstructorDescriptionPostgresIdentity
(BibernateDatabaseSettings bibernateDatabaseSettings, List<String> executedQueries) Constructs a new PostgresIdentity with the given BibernateDatabaseSettings and list of executed queries. -
Method Summary
Modifier and TypeMethodDescriptionprivate static GenerationType
getStrategy
(Class<?> entityClass) Retrieves the GenerationType strategy specified in the entity class annotations.<T> void
saveWithIdentity
(Class<T> entityClass, Collection<T> entities) Implements the saveWithIdentity method from the Identity interface.
-
Field Details
-
generators
List of generators for handling different GenerationType strategies. -
bibernateDatabaseSettings
The settings for Bibernate database interactions.
-
-
Constructor Details
-
PostgresIdentity
public PostgresIdentity(BibernateDatabaseSettings bibernateDatabaseSettings, List<String> executedQueries) Constructs a new PostgresIdentity with the given BibernateDatabaseSettings and list of executed queries.- Parameters:
bibernateDatabaseSettings
- the settings for Bibernate database interactionsexecutedQueries
- the list to store executed queries, if query collection is enabled
-
-
Method Details
-
saveWithIdentity
Implements the saveWithIdentity method from the Identity interface. Delegates the entity-saving operation to the appropriate generator based on the GenerationType strategy.- Specified by:
saveWithIdentity
in interfaceIdentity
- Type Parameters:
T
- the type of entities in the collection- Parameters:
entityClass
- the class of the entities to be savedentities
- the collection of entities to be saved
-
getStrategy
Retrieves the GenerationType strategy specified in the entity class annotations.- Parameters:
entityClass
- the class of the entity- Returns:
- the GenerationType strategy, or GenerationType.NONE if not specified
-