Just a quick note before I leave that might save someone else some work.
I went through the OpenBase failed tests, and posted what I figured out as
comments to the issue. Some appear to be openbase-specific errors. Some
appear to be cayenne testing issues. Some I couldn't identify. A few of
them need more research, but I'm out of time for today.
Here's the changes I made to get primary key support working for OpenBase.
This was only intended as a quick-fix.
Sorry for the non-diff code, but I'm heading out the door and figured it was
better to post something than nothing and have someone else have to redo it
all again.
Added this to OpenBaseAdapter:
================================
public String createTableExtra(DbEntity ent) {
// later we may support view creation
// for derived DbEntities
if (ent instanceof DerivedDbEntity) {
throw new CayenneRuntimeException(
"Can't create primary keys for derived DbEntity '" + ent.getName() +
"'.");
}
if (0 == ent.getPrimaryKey().size()) return null;
StringBuffer buf = new StringBuffer();
buf.append("CREATE PRIMARY KEY
").append(ent.getFullyQualifiedName()).append(" (");
boolean first = true;
Iterator pkit = ent.getPrimaryKey().iterator();
if (pkit.hasNext()) {
if (first)
first = false;
else
buf.append(", ");
boolean firstPk = true;
while (pkit.hasNext()) {
if (firstPk)
firstPk = false;
else
buf.append(", ");
DbAttribute at = (DbAttribute) pkit.next();
buf.append(at.getName());
}
}
buf.append(')');
return buf.toString();
}
================================
Changed org.objectstyle.cayenne.unittest.CayenneTestDatabaseSetup (and added
import for OpenBaseAdapter):
================================
queries.add(adapter.createTable(ent));
================================
queries.add(adapter.createTable(ent));
if (adapter instanceof OpenBaseAdapter)
{
OpenBaseAdapter anOpenBaseAdapter = (OpenBaseAdapter)adapter;
String extraStatement = anOpenBaseAdapter.createTableExtra(ent);
if (null != extraStatement) queries.add(extraStatement);
}
================================
This archive was generated by hypermail 2.0.0 : Fri Dec 05 2003 - 17:48:10 EST