日期:2014-05-16  浏览次数:20598 次

如何换数据库(未使用任何框架)

?

因为之前使用的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