mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-18 12:14:42 +00:00
fix[orm]: fix error entity clazz
This commit is contained in:
1 parent
c05df57821
commit
fe7873dbc6
1 file changed
+2
-3
+2
-3
@@ -307,8 +307,7 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
|
|||||||
var currentUpdateList = page.currentPageList(updateList);
|
var currentUpdateList = page.currentPageList(updateList);
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
var entityClazz = (Class<E>) currentUpdateList.get(0).getClass();
|
var collection = OrmContext.getOrmManager().getCollection(clazz);
|
||||||
var collection = OrmContext.getOrmManager().getCollection(entityClazz);
|
|
||||||
List<E> entities = currentUpdateList.stream().map(PNode::getEntity).toList();
|
List<E> entities = currentUpdateList.stream().map(PNode::getEntity).toList();
|
||||||
var batchList = entities.stream()
|
var batchList = entities.stream()
|
||||||
.map(it -> new ReplaceOneModel<E>(Filters.eq("_id", it.id()), it))
|
.map(it -> new ReplaceOneModel<E>(Filters.eq("_id", it.id()), it))
|
||||||
@@ -323,7 +322,7 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
|
|||||||
if (result.getMatchedCount() != entities.size()) {
|
if (result.getMatchedCount() != entities.size()) {
|
||||||
// 在数据库的批量更新操作中需要更新的数量和最终更新的数量不相同
|
// 在数据库的批量更新操作中需要更新的数量和最终更新的数量不相同
|
||||||
logger.warn("database:[{}] update size:[{}] not equal with matched size:[{}](some entity of id not exist in database)"
|
logger.warn("database:[{}] update size:[{}] not equal with matched size:[{}](some entity of id not exist in database)"
|
||||||
, entityClazz.getSimpleName(), entities.size(), result.getMatchedCount());
|
, clazz.getSimpleName(), entities.size(), result.getMatchedCount());
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.error("batchUpdate unknown exception", t);
|
logger.error("batchUpdate unknown exception", t);
|
||||||
|
|||||||
Reference in new issue
Block a user