createArtistsDataSet();
SelectQuery query = new SelectQuery(ROArtist.class, ExpressionFactory.matchExp(
Artist.ARTIST_NAME_PROPERTY,
"artist1"));
ROArtist a1 = (ROArtist) context.performQuery(query).get(0);
Painting painting = context.newObject(Painting.class);
painting.setPaintingTitle("paint");
a1.addToPaintingArray(painting);
assertEquals(PersistenceState.MODIFIED, a1.getPersistenceState());
try {
context.commitChanges();
}
catch (Exception ex) {
fail("Updating 'read-only' object's to-many must succeed, instead an exception was thrown: "
+ ex);
}
assertEquals(PersistenceState.COMMITTED, a1.getPersistenceState());
}