rd2.setDatabase(db);
rd2.setName("test report two");
rd2.setSql("select * from user");
rd2.setQueryType(QueryBuilder.QUERY_TYPE_STATIC);
rs.createReportDefinition(rd2);
DrillDownColumn ddc=new DrillDownColumn();
ddc.setName("name");
ddc.setParametersIndex(2);
rd.addDrillDownColumn(ddc);
rd2.addAssociatedDrillDownColumn(ddc);
ddcService.createDrillDownColumn(ddc);
assertEquals(rd.getDrillDownColumns().size(),1);
//getting the stored entity from session is redundant ?
DrillDownColumn stored=ddcService.getDrillDownColumn(ddc.getId());
assertEquals(ddc.getId(),stored.getId());
assertEquals(stored.getName(),"name");
assertEquals(stored.getParametersIndex(),2);
assertEquals(stored.getReportDefinition().getId(),rd.getId());
assertEquals(stored.getToReportDefinition().getId(),rd2.getId());
stored.setName("changed name");
ddcService.updateDrillDownColumn(stored);
assertEquals(stored.getName(),"changed name");
//test for cascade delete all associated DrillDownColumns
this.closeSession();
this.openSession();
rs=(ReportDefinitionService)context.getBean("reportDefinitionService");
rd2=rs.getReportDefinition(rd2.getId());