Веселое с работы

May 11, 2010 12:37

Игра «Передай другому» или «У нас тоже есть слои»:

public interface FinanceReportUtilsService {
List getAccountingPeriodsAsc(DateRange dateRange);
}

public class FinanceReportUtilsServiceImpl implements FinanceReportUtilsService {
@Override
public List getAccountingPeriodsAsc(DateRange dateRange) {
return accountingPeriodService.getAccountingPeriodsAsc(dateRange);
}
}

public interface AccountingPeriodService {
List getAccountingPeriodsAsc(DateRange dateRange);
}

public class AccountingPeriodServiceImpl implements AccountingPeriodService {
@Override
public List getAccountingPeriodsAsc(DateRange dateRange) {
return ((AccountingPeriodDAO) getDao()).getAccountingPeriodsAsc(dateRange);
}
}

public interface AccountingPeriodDAO {
List getAccountingPeriodsAsc(DateRange dateRange);
}

public class AccountingPeriodDAOImpl implements AccountingPeriodDAO {
@Override
public List getAccountingPeriodsAsc(DateRange dateRange) {
// здесь наконец реализация!
}
}

Hibernate мы тоже используем, как без него:

public BuildingProperties loadDetails(Long id) {
BuildingProperties buildingProperties = super.loadDetails(id);

if (buildingProperties != null) {
BuildingProperties ul;
Hibernate.initialize(buildingProperties.getAddressBuilding().getAddresses());
Hibernate.initialize(ul = buildingProperties.getUpLevel());
if (ul != null) {
Building b;
Hibernate.initialize(b = ul.getAddressBuilding());
if (b != null) {
Street s;
Hibernate.initialize(s = b.getStreet());
if (s != null) {
City c;
Hibernate.initialize(c = s.getCity());
if (c != null) {
District d;
Hibernate.initialize(d = c.getDistrict());
if (d != null) {
Hibernate.initialize(d.getArea());
}
}
}
}
Hibernate.initialize(ul.getServicingCompany());
}
}
return buildingProperties;
}

погрузите меня в Гибернейт, я офигеваю дорогая редакция, девелопмент, легенды острова Ява, плохо

Previous post Next post
Up