// if(ojbSkipKnownIssueProblem()) return;
String name = "testUpdateWithProxy_" + System.currentTimeMillis();
ProductGroup pg1 = new ProductGroup(null, name + "_1", "a group");
ProductGroup pg2 = new ProductGroup(null, name + "_2", "a group");
Article a1 = createArticle(name);
a1.setProductGroup(pg1);
TransactionExt tx = (TransactionExt) odmg.newTransaction();
tx.begin();
database.makePersistent(a1);
database.makePersistent(pg1);
database.makePersistent(pg2);
tx.commit();
tx.begin();
tx.getBroker().clearCache();
/**
* 1. get all articles from groups and add a new article
*/
OQLQuery query = odmg.newOQLQuery();
query.create("select productGroup from " + ProductGroup.class.getName() + " where groupName like $1");
query.bind(name + "%");
Collection results = (Collection) query.execute();
assertEquals(2, results.size());
Iterator it = results.iterator();
InterfaceProductGroup temp = null;
/**
* to each productgroup add an article with a pre-determined name.
*/
while (it.hasNext())
{
Article article = createArticle(name);
temp = (InterfaceProductGroup) it.next();
tx.lock(temp, Transaction.WRITE);
temp.add(article);
article.setProductGroup(temp);
}
tx.commit();
/**
* 2. requery and find the articles we added.