*/
OQLQuery query = odmg.newOQLQuery();
query.create("select productGroup from " + ProductGroup.class.getName());
Collection results = (Collection) query.execute();
Iterator it = results.iterator();
InterfaceProductGroup temp = null;
/**
* to each productgroup add an article with a pre-determined name.
*/
int i = 2300;
while (it.hasNext())
{
Article article = createArticle(i++);
article.setArticleName("OneToManyUpdateTest");
temp = (InterfaceProductGroup) it.next();
tx.lock(temp, Transaction.WRITE);
temp.add(article);
article.setProductGroup(temp);
}
tx.commit(); // thma: during this commit no article is persisted! works as designed!
/**
* 2. requery and find the articles we added.
*/
query = odmg.newOQLQuery();
query.create("select productGroup from " + ProductGroup.class.getName());
results = (Collection) query.execute();
it = results.iterator();
temp = null;
boolean found = false;
while (it.hasNext())
{
found = false;
temp = (InterfaceProductGroup) it.next();
Collection articles = temp.getAllArticles();
Iterator it2 = articles.iterator();
while (it2.hasNext())
{
InterfaceArticle art = (InterfaceArticle) it2.next();
if (art.getArticleName() != null)