mirror of https://github.com/apache/openjpa.git
OPENJPA-1700 FindBugs - Inefficient use of keySet iterator instead of entrySet iterator. Also, inefficient use of temporary Map when results can be used immediately
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@956883 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af772a734b
commit
75bd5fe6a7
|
@ -88,22 +88,17 @@ public class MixedLockManager extends PessimisticLockManager {
|
|||
//
|
||||
if(!dict.supportsLockingWithMultipleTables) {
|
||||
// look for columns mapped to secondary tables which need to be locked
|
||||
Map<DBIdentifier,FieldMapping> colsMappedToSecTable = new HashMap<DBIdentifier,FieldMapping>();
|
||||
FieldMapping fms[] = mapping.getFieldMappings();
|
||||
for( FieldMapping fm : fms) {
|
||||
DBIdentifier secTableName = fm.getMappingInfo().getTableIdentifier();
|
||||
if(!DBIdentifier.isNull(secTableName)) {
|
||||
colsMappedToSecTable.put(secTableName, fm);
|
||||
if (!DBIdentifier.isNull(secTableName)) {
|
||||
// select only the PK columns, since we just want to lock
|
||||
Select select = factory.newSelect();
|
||||
select.select(fm.getColumns());
|
||||
select.whereForeignKey(fm.getJoinForeignKey(), id, mapping, _store);
|
||||
sqls.add(select.toSelect(true, fetch));
|
||||
}
|
||||
}
|
||||
for( DBIdentifier secTableName : colsMappedToSecTable.keySet()) {
|
||||
FieldMapping fm = colsMappedToSecTable.get(secTableName);
|
||||
// select only the PK columns, since we just want to lock
|
||||
Select select = factory.newSelect();
|
||||
select.select(fm.getColumns());
|
||||
select.whereForeignKey(fm.getJoinForeignKey(), id, mapping, _store);
|
||||
sqls.add(select.toSelect(true, fetch));
|
||||
}
|
||||
}
|
||||
return sqls;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue