因为之前使用的mysql 现在想转为Oracle实现
如何改能降低最大的工作量
DaoFactory 类 里面组合了 Dao的实例
ServiceFactory 类 里面 组合了 Service实例
ps:这两个类不算工厂类 应将类名Factory改成Contextg更合适
具体下面贴代码
public class DaoFactory
{
private static IAccountDao accountDao = new AccountDaoImpl();
private static IAffairDao affairDao = new AffairDaoImpl();
private static IStateDao stateDao = new StateDaoImpl();
private static IPersonnelDao personnelDao = new PersonnelDaoImpl();
private static IAnnouncementDao announcementDao = new AnnouncementDaoImpl();
private static IStatDao statDao = new StatDaoImpl();
private static IDepartmentDao departmentDao = new DepartmentDaoImpl();
private static IPositionDao positionDao = new PositionDaoImpl();
private static IInformationDao informationDao = new InformationDaoImpl();
private static IDaysDao daysDao = new DaysDaoImpl();
private static IWeekDao weekDao = new WeekDaoImpl();
private static IWorkContentDao workContentDao = new WorkContentDaoImpl();
private static IEmployeeManageDao employeeManageDao = new EmployeeManageDaoImpl();
private static IHolidayDao holidayDao = new HolidayDaoImpl();
private static IHolidayTypeDao holidayTypeDao = new HolidayTypeDaoImpl();
private static IMessageDao messageDao = new MessageDaoImpl();
public static IMessageDao getMessageDao()
{
return messageDao;
}
public static IAccountDao getAccountDao()
{
return accountDao;
}
public static IAffairDao getAffairDao()
{
return affairDao;
}
public static IStateDao getStateDao()
{
return stateDao;
}
public static IPersonnelDao getPersonnelDao()
{
return personnelDao;
}
public static IAnnouncementDao getAnnouncementDao()
{
return announcementDao;
}
public static IStatDao getStatDao()
{
return statDao;
}
public static IDepartmentDao getDepartmentDao()
{
return departmentDao;
}
public static IPositionDao getPositionDao()
{
return positionDao;
}
public static IInformationDao getInformationDao()
{
return informationDao;
}
public static IDaysDao getDaysDao()
{
return daysDao;
}
public static IWeekDao getWeekDao()
{
return weekDao;
}
public static IWorkContentDao getWorkContentDao()
{
return workContentDao;
}
public static IEmployeeManageDao getEmployeeManageDao()
{
return employeeManageDao;
}
public static IHolidayDao getHolidayDao()
{
return holidayDao;
}
public static IHolidayTypeDao getHolidayTypeDao()
{
return holidayTypeDao;
}
}
public class ServiceFactory
{
private static IAccountService accountService = new AccountServiceImpl();
private static IAffixService affixService = new AffixServiceImpl();
private static IAffairService affairService = new AffairServiceImpl();
private static IStateService stateService = new StateServiceImpl();
private static IPersonnelService personnelService = new PersonnelServiceImpl();
private static IAnnouncementService announcementService = new AnnouncementServiceImpl();
private static IStatService statService = new StatServiceImpl();
private static IDepartmentService departmentService = new DepartmentServiceImpl();
private static IWorkContentService workContentService = new WorkContentServiceImpl();
private static IInformationService informationService = new InformationServiceImpl();
private static IPositionService positionService = new PositionServiceImpl();
private static IDaysService daysService = new DaysServiceImpl();
private static IWeekService weekService = new WeekServiceImpl();
private static IEmployeeManageService employeeManageService = new EmployeeServiceImpl();
private static IHolidayService holidayService = new HolidayServiceImpl();
private static IHolidayTypeService holidayTypeService = new HolidayTypeServiceImpl();
private static IMessageService messageService = new MessageServiceImpl();
public static IMessageService getMessageService()
{
return messageService;
}
public static IEmployeeManageService getEmployeeManageService()
{
return employeeManageService;
}
public static IAccountService getAccountService()
{
return accountService;
}
public static IAffixService getAffixService()
{
return affixService;
}
public static IAffairService getAffairService()
{
return affairService;
}
public static IStateService getStateService()
{
return stateService;
}
public static IPersonnelService getPersonnelService()
{
return personnelService;
}
public static IAnnouncementService getAnnouncementService()
{
return announcementService;
}
public static IStatService getStatService()
{
return statService;
}
public static IDepartmentService getDepartmentService()
{
return departmentService;
}
public static IWorkContentService getWorkContentService()
{
return workContentService;
}
public static IInformationService getInformationService()
{
return informationService;
}
public static IPositionService getPositionService()
{
return positionService;
}
public static IDaysService getDaysService()
{
return daysService;
}
public static IWeekService getWeekService()
{
return weekService;
}
public static IHolidayService getHolidayService()
{
return holidayService;
}
public static IHolidayTypeService getHolidayTypeService()
{
return holidayTypeService;
}
}
例如 AccountServiceImpl 的实现
public class AccountServiceImpl implements IAccountService
{
public AccountBean login(String name, String password)
{
return DaoFactory.getAccountDao().login(name, password);
}
}