Guest User

Untitled

a guest
Jun 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. @Override
  2. public List<ProjectDashboardProjectItemDTO>
  3. getProjectDashBoardProjectItems() {
  4. return getSessionFactory().getCurrentSession()
  5. .createCriteria(Project.class)
  6. .createAlias("customer", "c")
  7. .setProjection(
  8. Projections.projectionList()
  9.  
  10.  
  11. .add(Projections.groupProperty("c.name").as("clientName"))
  12.  
  13. .add(Projections.groupProperty("name").as("projectName"))
  14.  
  15. .add(Projections.property("id").as("projectId"))
  16.  
  17. .add(Projections.sqlProjection(
  18. "(SELECT
  19. sum(projectBudgetItems.budgetedMinutes) from PROJECT_BUDGET_ITEMS
  20. projectBudgetItems where projectBudgetItems.project_id = this_.id) as
  21. budgetedMinutes",
  22. new String[]{"budgetedMinutes"},
  23. new Type[]{Hibernate.INTEGER}))
  24. .add(Projections.sqlProjection(
  25. "(SELECT sum(entry.minutes) from
  26. TIME_ENTRIES entry where entry.project_id = this_.id) as actualMinutes",
  27. new String[]{"actualMinutes"},
  28. new Type[]{Hibernate.INTEGER}))
  29. )
  30.  
  31. .setResultTransformer(Transformers.aliasToBean(ProjectDashboardProjectItemDTO.class))
  32. .list();
  33.  
  34.  
  35. }
Add Comment
Please, Sign In to add comment