本文整理了Java中org.mongodb.morphia.query.Query.getEntityClass
方法的一些代码示例,展示了Query.getEntityClass
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getEntityClass
方法的具体详情如下:
包路径:org.mongodb.morphia.query.Query
类名称:Query
方法名:getEntityClass
暂无
代码示例来源:origin: BlackLabs/play-morphia
public Class<? extends Model> getEntityClass() {
return q_.getEntityClass();
}
代码示例来源:origin: org.actframework/act-morphia
public Class<MODEL_TYPE> getEntityClass() {
return mq.getEntityClass();
}
代码示例来源:origin: org.mongodb.morphia/morphia
private <T> void updateForVersioning(final Query<T> query, final UpdateOperations<T> operations) {
final MappedClass mc = mapper.getMappedClass(query.getEntityClass());
if (!mc.getFieldsAnnotatedWith(Version.class).isEmpty()) {
operations.inc(mc.getMappedVersionField().getNameToStore());
}
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> WriteResult delete(final Query<T> query) {
return delete(query, new DeleteOptions().writeConcern(getWriteConcern(query.getEntityClass())));
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> WriteResult delete(final Query<T> query, final DeleteOptions options) {
DBCollection dbColl = query.getCollection();
// TODO remove this after testing.
if (dbColl == null) {
dbColl = getCollection(query.getEntityClass());
}
if (query.getSortObject() != null || query.getOffset() != 0 || query.getLimit() > 0) {
throw new QueryException("Delete does not allow sort/offset/limit query options.");
}
return dbColl.remove(query.getQueryObject(), enforceWriteConcern(options, query.getEntityClass()).getOptions());
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> UpdateResults update(final Query<T> query, final UpdateOperations<T> operations, final boolean createIfMissing) {
return update(query, operations, new UpdateOptions()
.upsert(createIfMissing)
.writeConcern(getWriteConcern(query.getEntityClass())));
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> UpdateResults update(final Query<T> query, final UpdateOperations<T> operations) {
return update(query, operations, new UpdateOptions()
.upsert(false)
.multi(true)
.writeConcern(getWriteConcern(query.getEntityClass())));
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> UpdateResults update(final Query<T> query, final UpdateOperations<T> operations, final UpdateOptions options) {
DBCollection dbColl = query.getCollection();
// TODO remove this after testing.
if (dbColl == null) {
dbColl = getCollection(query.getEntityClass());
}
final MappedClass mc = getMapper().getMappedClass(query.getEntityClass());
final List<MappedField> fields = mc.getFieldsAnnotatedWith(Version.class);
DBObject queryObject = query.getQueryObject();
if (operations.isIsolated()) {
queryObject.put("$isolated", true);
}
if (!fields.isEmpty()) {
operations.inc(fields.get(0).getNameToStore(), 1);
}
final BasicDBObject update = (BasicDBObject) ((UpdateOpsImpl) operations).getOps();
if (LOG.isTraceEnabled()) {
LOG.trace(format("Executing update(%s) for query: %s, ops: %s, multi: %s, upsert: %s",
dbColl.getName(), queryObject, update, options.isMulti(), options.isUpsert()));
}
return new UpdateResults(dbColl.update(queryObject, update,
enforceWriteConcern(options, query.getEntityClass())
.getOptions()));
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> T findAndDelete(final Query<T> query, final FindAndModifyOptions options) {
DBCollection dbColl = query.getCollection();
if (dbColl == null) {
dbColl = getCollection(query.getEntityClass());
}
if (LOG.isTraceEnabled()) {
LOG.trace("Executing findAndModify(" + dbColl.getName() + ") with delete ...");
}
FindAndModifyOptions copy = enforceWriteConcern(options, query.getEntityClass())
.copy()
.projection(query.getFieldsObject())
.sort(query.getSortObject())
.returnNew(false)
.upsert(false)
.remove(true);
final DBObject result = dbColl.findAndModify(query.getQueryObject(), copy.getOptions());
return result == null ? null : mapper.fromDBObject(this, query.getEntityClass(), result, createCache());
}
代码示例来源:origin: org.mongodb.morphia/morphia
dbColl = getCollection(query.getEntityClass());
final MappedClass mc = getMapper().getMappedClass(query.getEntityClass());
final List<MappedField> fields = mc.getFieldsAnnotatedWith(Version.class);
if (!fields.isEmpty()) {
enforceWriteConcern(options, query.getEntityClass())
.getOptions()));
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> T findAndModify(final Query<T> query, final UpdateOperations<T> operations, final FindAndModifyOptions options) {
DBCollection dbColl = query.getCollection();
// TODO remove this after testing.
if (dbColl == null) {
dbColl = getCollection(query.getEntityClass());
}
if (LOG.isTraceEnabled()) {
LOG.info("Executing findAndModify(" + dbColl.getName() + ") with update ");
}
updateForVersioning(query, operations);
DBObject res = dbColl.findAndModify(query.getQueryObject(), options.copy()
.sort(query.getSortObject())
.projection(query.getFieldsObject())
.update(((UpdateOpsImpl<T>) operations).getOps())
.getOptions());
return res == null ? null : mapper.fromDBObject(this, query.getEntityClass(), res, createCache());
}
内容来源于网络,如有侵权,请联系作者删除!