Class ReservationRepositoryFactory

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

public class ReservationRepositoryFactory extends Object
A factory of repositories for Reservation entities.
  • Constructor Details

    • ReservationRepositoryFactory

      public ReservationRepositoryFactory()
      Empty constructor.
  • Method Details

    • createReservationRepository

      public ReservationMongoRepository createReservationRepository(com.mongodb.client.MongoClient mongoClient, com.mongodb.client.ClientSession session, String databaseName) throws IllegalArgumentException
      Creates a new repository for Reservation 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 ReservationMongoRepository for facing the MongoDB database.
      Throws:
      IllegalArgumentException - if at least mongoClient or session is null.
    • createReservationRepository

      public ReservationPostgresRepository createReservationRepository(jakarta.persistence.EntityManager em)
      Creates a new repository for Reservation entities using PostgresSQL and a JPA provider.
      Parameters:
      em - the entity manager using PostgreSQL database.
      Returns:
      a new ReservationPostgresRepository for facing the PostgreSQL database.
      Throws:
      IllegalArgumentException - if em is null.