Class ClientRepositoryFactory
java.lang.Object
io.github.marcopaglio.booking.repository.factory.ClientRepositoryFactory
A factory of repositories for Client entities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateClientRepository(com.mongodb.client.MongoClient mongoClient, com.mongodb.client.ClientSession session, String databaseName) Creates a new repository for Client entities using a MongoDB client and session.createClientRepository(jakarta.persistence.EntityManager em) Creates a new repository for Client entities using PostgresSQL and a JPA provider.
-
Constructor Details
-
ClientRepositoryFactory
public ClientRepositoryFactory()Empty constructor.
-
-
Method Details
-
createClientRepository
public ClientMongoRepository createClientRepository(com.mongodb.client.MongoClient mongoClient, com.mongodb.client.ClientSession session, String databaseName) throws IllegalArgumentException Creates a new repository for Client entities using a MongoDB client and session.- Parameters:
mongoClient- the client using the MongoDB database.session- the session in which database operations are performed.databaseName- the name of the database in which the repository works.- Returns:
- a new
ClientMongoRepositoryfor facing the MongoDB database. - Throws:
IllegalArgumentException- if at leastmongoClientorsessionis null.
-
createClientRepository
public ClientPostgresRepository createClientRepository(jakarta.persistence.EntityManager em) throws IllegalArgumentException Creates a new repository for Client entities using PostgresSQL and a JPA provider.- Parameters:
em- the entity manager using PostgreSQL database.- Returns:
- a new
ClientPostgresRepositoryfor facing the PostgreSQL database. - Throws:
IllegalArgumentException- ifemis null.
-