Class ClientRepositoryFactory

java.lang.Object
io.github.marcopaglio.booking.repository.factory.ClientRepositoryFactory

public class ClientRepositoryFactory extends Object
A factory of repositories for Client entities.
  • 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 ClientMongoRepository for facing the MongoDB database.
      Throws:
      IllegalArgumentException - if at least mongoClient or session is 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 ClientPostgresRepository for facing the PostgreSQL database.
      Throws:
      IllegalArgumentException - if em is null.