DataObject user = ssn.create( "examples.User");
DataObject user = ssn.create(getModelName() + ".User");
    public void testLinkAttributes() throws DataObjectNotFoundException {        Session ssn = SessionManager.getSession();        DataObject article = ssn.create(getModelName() + ".Article");	DataObject user = ssn.create( "examples.User");	user.set("id", BigInteger.ZERO);	user.set("email", "foo@bar.com");	user.set("firstName", "foo");	user.set("lastNames", "bar");	user.save();        article.set("id", BigInteger.ZERO);        String text = "This is the article text.";        article.set("text", text);        int numItems = 10;        for (int i = 0; i < numItems; i++) {            DataObject image = ssn.create(getModelName() + ".Image");            image.set("id", new BigInteger(Integer.toString(i)));            byte[] bytes = "This is the image.".getBytes();            image.set("bytes", bytes);            image.save();        }        String captionPrefix = "This is the caption for ";        DataAssociation images = (DataAssociation) article.get("images");        DataCollection samples = ssn.retrieve(getModelName() + ".Image");        while (samples.next()) {            DataObject image = samples.getDataObject();            DataObject link = images.add(image);            link.set("caption", captionPrefix + image.getOID());	    link.set("user", user);        }        article.save();        String newCaptionPrefix = "This is the new caption for ";        DataAssociationCursor cursor = images.cursor();        while (cursor.next()) {            DataObject image = cursor.getDataObject();            DataObject link = cursor.getLink();            DataObject linkuser = (DataObject)link.get("user");	    assertNotNull("User is null!", linkuser);            assertEquals("bad link object",                         captionPrefix + image.getOID(),                         link.get("caption"));            link.set("caption", newCaptionPrefix + image.getOID());        }        article.save();        cursor = images.cursor();        while (cursor.next()) {            DataObject image = cursor.getDataObject();            DataObject link = cursor.getLink();            assertEquals("bad link object",                         newCaptionPrefix + image.getOID(),                         link.get("caption"));        }        // Now let's try some filtering. This should probably be split out        // into a seperate test, but I'm in a hurry now.        cursor = images.cursor();        cursor.addFilter("link.caption not like 'This %'");        assertEquals("filtering on a link attribute didn't work",                     0,                     cursor.size());        cursor = images.cursor();        cursor.addFilter("link.caption like 'This %'");        assertEquals("filtering on a link attribute didn't work",                     numItems,                     cursor.size());    }