private void loadLoadGroups(JDBCEntityMetaData metadata) {
loadGroupMasks = new HashMap();
// load optimistic locking mask and add it to all the load group masks
JDBCOptimisticLockingMetaData olMD = metadata.getOptimisticLocking();
if (olMD != null) {
if (versionField != null) {
defaultLockGroupMask = new boolean[tableFields.length];
defaultLockGroupMask[versionField.getTableIndex()] = true;
versionField.setLockingStrategy(LockingStrategy.VERSION);
} else if (olMD.getGroupName() != null) {
defaultLockGroupMask = loadGroupMask(olMD.getGroupName(), null);
for (int i = 0; i < tableFields.length; ++i) {
if (defaultLockGroupMask[i]) {
JDBCCMPFieldBridge tableField = tableFields[i];
tableField.setLockingStrategy(LockingStrategy.GROUP);
tableField.addDefaultFlag(ADD_TO_WHERE_ON_UPDATE);
}
}
} else {// read or modified strategy
LockingStrategy strategy =
(olMD.getLockingStrategy() == JDBCOptimisticLockingMetaData.LockingStrategy.READ_STRATEGY ?
LockingStrategy.READ : LockingStrategy.MODIFIED
);
for (int i = 0; i < tableFields.length; ++i) {
JDBCCMPFieldBridge field = tableFields[i];
if (!field.isPrimaryKeyMember())