}
public void testPathExpressionOqlQuery() throws Exception
{
// get facade instance
Implementation odmg = OJB.getInstance();
Database db = odmg.newDatabase();
//open database
try
{
db.open(databaseName, Database.OPEN_READ_WRITE);
}
catch (ODMGException ex)
{
fail("ODMGException: " + ex.getMessage());
}
Transaction tx = odmg.newTransaction();
// perform transaction
tx.begin();
OQLQuery query = odmg.newOQLQuery();
// use 'like' instead of '=' when perform query with wildcards
query.create(
"select anArticle from " + Article.class.getName() + " where productGroup.groupName like \"Fruit*\"");
List results = (List) query.execute();
// crosscheck
query = odmg.newOQLQuery();
query.create("select aPG from " + ProductGroup.class.getName() + " where groupName like \"Fruit*\"");
List check = (List) query.execute();
if (check.size() < 1)
fail("Could not found ProductGroup's for: " +
"select aPG from " + ProductGroup.class.getName() + " where groupName like \"Fruit*\"");