references.add(a2.getUuid());
// --------------------------------------------------------------------------------
// Create and store an object B in the repository which has a collection of A
// --------------------------------------------------------------------------------
B b = new B();
b.setPath("/testB");
b.setMultiReferences(references);
ocm.insert(b);
ocm.save();
// --------------------------------------------------------------------------------
// Retrieve object B
// --------------------------------------------------------------------------------
b = (B) ocm.getObject("/testB");
Collection allref = b.getMultiReferences();
assertNotNull("collection is null", allref);
assertTrue("Invalid number of items in the collection", allref.size() == 2);
// --------------------------------------------------------------------------------
// Update object B with invalid uuid
// --------------------------------------------------------------------------------
allref.add("12345");
b.setMultiReferences(allref);
try
{
ocm.update(b);
fail("Exception not throw");
}
catch(Exception e)
{
//Throws an exception due to an invalid uuid
System.out.println("Invalid uuid value in the collection : " + e);
}
// --------------------------------------------------------------------------------
// Update object B with an null value
// --------------------------------------------------------------------------------
b.setMultiReferences(null);
ocm.update(b);
ocm.save();
// --------------------------------------------------------------------------------
// Retrieve object B
// --------------------------------------------------------------------------------
b = (B) ocm.getObject("/testB");
assertNull("a is not null", b.getMultiReferences());
}
catch (Exception e)
{