Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public List<ProjectDashboardProjectItemDTO>
- getProjectDashBoardProjectItems() {
- return getSessionFactory().getCurrentSession()
- .createCriteria(Project.class)
- .createAlias("customer", "c")
- .setProjection(
- Projections.projectionList()
- .add(Projections.groupProperty("c.name").as("clientName"))
- .add(Projections.groupProperty("name").as("projectName"))
- .add(Projections.property("id").as("projectId"))
- .add(Projections.sqlProjection(
- "(SELECT
- sum(projectBudgetItems.budgetedMinutes) from PROJECT_BUDGET_ITEMS
- projectBudgetItems where projectBudgetItems.project_id = this_.id) as
- budgetedMinutes",
- new String[]{"budgetedMinutes"},
- new Type[]{Hibernate.INTEGER}))
- .add(Projections.sqlProjection(
- "(SELECT sum(entry.minutes) from
- TIME_ENTRIES entry where entry.project_id = this_.id) as actualMinutes",
- new String[]{"actualMinutes"},
- new Type[]{Hibernate.INTEGER}))
- )
- .setResultTransformer(Transformers.aliasToBean(ProjectDashboardProjectItemDTO.class))
- .list();
- }
Add Comment
Please, Sign In to add comment