📄 ex7_24.txt
字号:
Example 7.24 Implementing Lazy Loading strategy
...
public Collection getSkillSetsData() {
throws SkillSetException {
checkSkillSetLoad();
return skillSets;
}
private void checkSkillSetLoad()
throws SkillSetException {
try {
// Lazy Load strategy...Load on demand
if (skillSets == null)
skillSets =
getSkillSetDAO().findAllSkills(resourceId);
} catch (Exception exception) {
// No skills, throw an exception
throw new SkillSetException(...);
}
}
...
public void ejbLoad() {
try {
// load the resource info from
ResourceDAO resourceDAO = new ResourceDAO();
setResourceData(
resourceDAO.findResource(employeeId));
// If the lazy loaded objects are already
// loaded, they need to be reloaded.
// If there are not loaded, do not load them
// here...lazy load will load them later.
if (skillSets != null) {
reloadSkillSets();
}
if (blockOutTimes != null) {
reloadBlockOutTimes();
}
...
throw new EJBException("Reason:"+...);
}
}
...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -