DatasetData dd = simpleDatasetData(); Set dss = new HashSet(); dss.add(dd); imgData = simpleImageData(); imgData.setDatasets(dss);
imgData = simpleImageDataWithDatasets();
    public void testAndSaveSomtheingWithParents() throws Exception    {        DatasetData dd = simpleDatasetData();        Set dss = new HashSet();        dss.add(dd);        imgData = simpleImageData();        imgData.setDatasets(dss);                img = (Image) reverse.map(imgData);        img = (Image) iUpdate.saveAndReturnObject(img);        assertTrue("It better have a dataset link",                img.sizeOfDatasetLinks()>0);        ds = (Dataset) img.iterateOverDatasetLinks().next();        Long id = ds.getId();                // another copy        Image img2 = (Image) iQuery.queryUnique(                "select i from Image i " +                "left outer join fetch i.datasetLinks " +                "where i.id = ?",                new Object[]{img.getId()});        assertTrue("It better have a dataset link too",                img2.sizeOfDatasetLinks()>0);        Dataset ds2 = (Dataset) img2.iterateOverDatasetLinks().next();        assertTrue("And the ids have to be the same",id.equals(ds2.getId()));    }