public abstract class AbstractMongoSession extends AbstractSession
Abstract implementation on the Session interface for MongoDB
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
MONGO_SET_OPERATOR |
|
static java.lang.String |
MONGO_UNSET_OPERATOR |
|
protected static java.util.Map<PersistentEntity, com.mongodb.WriteConcern> |
declaredWriteConcerns |
|
protected java.lang.String |
defaultDatabase |
|
protected boolean |
errorOccured |
|
protected java.util.Map<PersistentEntity, java.lang.String> |
mongoCollections |
|
protected java.util.Map<PersistentEntity, java.lang.String> |
mongoDatabases |
|
protected MongoDatastore |
mongoDatastore |
|
protected com.mongodb.WriteConcern |
writeConcern |
Constructor and description |
---|
AbstractMongoSession
(MongoDatastore datastore, MappingContext mappingContext, org.springframework.context.ApplicationEventPublisher publisher) |
AbstractMongoSession
(MongoDatastore datastore, MappingContext mappingContext, org.springframework.context.ApplicationEventPublisher publisher, boolean stateless) |
Type Params | Return Type | Name and description |
---|---|---|
|
protected void |
addPostFlushOperations(java.util.List<PendingOperation> cascadeOperations) |
<T> |
public abstract T |
decode(java.lang.Class<T> type, java.lang.Object nativeObject) Decodes the given entity type from the given native object type |
|
public void |
flush() |
|
public abstract void |
flush(com.mongodb.WriteConcern writeConcern) |
|
public com.mongodb.client.MongoCollection<org.bson.Document> |
getCollection(PersistentEntity entity) |
|
public java.lang.String |
getCollectionName(PersistentEntity entity) |
|
public java.lang.String |
getDatabase(PersistentEntity entity)
|
|
public MongoDatastore |
getDatastore() |
|
public com.mongodb.WriteConcern |
getDeclaredWriteConcern(PersistentEntity entity) |
|
private com.mongodb.WriteConcern |
getDeclaredWriteConcern(com.mongodb.WriteConcern defaultConcern, PersistentEntity entity) |
|
public java.lang.String |
getDefaultDatabase()
|
|
public DocumentMappingContext |
getDocumentMappingContext() |
|
public MongoMappingContext |
getMappingContext() |
|
public com.mongodb.client.MongoClient |
getNativeInterface() |
|
public com.mongodb.WriteConcern |
getWriteConcern() Obtains the WriteConcern to use for the session |
|
public boolean |
hasTransaction() |
|
public void |
setWriteConcern(com.mongodb.WriteConcern writeConcern) Sets the WriteConcern to use for the session |
|
public java.lang.String |
useCollection(PersistentEntity entity, java.lang.String collectionName) Use the given collection for the given entity |
|
public java.lang.String |
useDatabase(PersistentEntity entity, java.lang.String databaseName) Use the given database name for the given entity |
Decodes the given entity type from the given native object type
type
- A GORM entity typenativeObject
- A native MongoDB object type (Document, FinderIterable etc.)T
- The concrete type of the entity
Obtains the WriteConcern to use for the session
Sets the WriteConcern to use for the session
writeConcern
- The WriteConcern to useUse the given collection for the given entity
entity
- The entitycollectionName
- The collectionUse the given database name for the given entity
entity
- The entity namedatabaseName
- The database name