if(ojbSkipKnownIssueProblem("Update by reachabilitiy doesn't work proper"))
{
return;
}
Transaction tx = null;
ProductGroup pg;
Article article;
Article article2;
org.apache.ojb.broker.Person person;
org.apache.ojb.broker.Project project;
Identity aOid = null;
Identity aOid2 = null;
Identity pgOid = null;
Identity prsOid = null;
Identity prjOid = null;
//perform transaction
try
{
tx = _kit.getTransaction(_conn);
tx.begin();
pg = new ProductGroup();
pg.setId(new Integer(77777));
pgOid = _conn.getIdentity(pg);
pg.setName("1");
_conn.makePersistent(pg);
article = Article.createInstance();
article.setArticleId(new Integer(77777));
aOid = _conn.getIdentity(article);
article.setStock(333);
pg.add(article);
article.setProductGroup(pg);
article2 = Article.createInstance();
article2.setArticleId(new Integer(77778));
aOid2 = _conn.getIdentity(article2);
article2.setStock(334);
pg.add(article2);
article2.setProductGroup(pg);
_conn.makePersistent(article);
_conn.makePersistent(article2);
person = new org.apache.ojb.broker.Person(77777, "first", "last");
prsOid = _conn.getIdentity(person);
project = new org.apache.ojb.broker.Project(77777, "title", "desc");
prjOid = _conn.getIdentity(project);
_conn.makePersistent(person);
_conn.makePersistent(project);
tx.commit();
tx = _kit.getTransaction(_conn);
tx.begin();
pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
InterfaceArticle articleNew1 = (InterfaceArticle) pg.getAllArticles().get(0);
InterfaceArticle articleNew2 = (InterfaceArticle) pg.getAllArticles().get(1);
if (!_conn.getIdentity(articleNew2).equals(aOid2))
{
articleNew2 = (InterfaceArticle) pg.getAllArticles().get(0);
articleNew1 = (InterfaceArticle) pg.getAllArticles().get(1);
if (!_conn.getIdentity(article2).equals(aOid2))
{
fail("Missing the second article");
}
}
articleNew1.setStock(433);
articleNew2.setStock(434);
pg.setName("2");
tx.commit();
tx = _kit.getTransaction(_conn);
tx.begin();
_conn.invalidateAll();