Class MongoRepository<T>
java.lang.Object
io.github.marcopaglio.booking.repository.mongo.MongoRepository<T>
- Type Parameters:
T- the entity type managed by the repository.
- Direct Known Subclasses:
ClientMongoRepository,ReservationMongoRepository
Facade of repository layer for using with MongoDB database.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.mongodb.client.MongoCollection<T>Collection of entities of type T used by the repository layer.protected com.mongodb.client.ClientSessionSession used to communicate with MongoDB database. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMongoRepository(com.mongodb.client.MongoCollection<T> collection, com.mongodb.client.ClientSession session) Sets the collection of entities of type T and the session used by the repository layer. -
Method Summary
Modifier and TypeMethodDescriptionfinal com.mongodb.client.MongoCollection<T>Retrieves the collection of entities of type T used by the repository layer.
-
Field Details
-
collection
Collection of entities of type T used by the repository layer. -
session
protected com.mongodb.client.ClientSession sessionSession used to communicate with MongoDB database.
-
-
Constructor Details
-
MongoRepository
protected MongoRepository(com.mongodb.client.MongoCollection<T> collection, com.mongodb.client.ClientSession session) Sets the collection of entities of type T and the session used by the repository layer.- Parameters:
collection- theMongoCollectionof typeTto set.session- theClientSessionto set.
-
-
Method Details
-
getCollection
Retrieves the collection of entities of type T used by the repository layer.- Returns:
- the
MongoCollectionof typeTused by the repository.
-