unsupported class hierarchy change in Db4o
I have:
static class Db4o...
and:
class Db4oBase... // which uses Db4o class
where I can:
class Customer : Db4oBase
{
public Customer(string name)
{
}
}
so that I can:
Customer customer = new Customer("Acbel Polytech Philippines");
customer.store(); //something like that
It worked, until sometime in my development, the code below suddenly bugged down:
class Db4o
{
.
.
.
public static IObjectSet Retrieve(object obj)
{
IObjectSet objectSet = null;
objectSet = container.Ext().QueryByExample(obj); // This part of the code
// throws a unsupported
// class hierarchy.
return objectSet;
}
}
The QueryByExa开发者_如何学Cmple instruction throws an unsupported class hierarchy. Does anybody know what should I do?
It happened when you:
- Code a class and then run the program.
- Later you modify the code and add/change the parent class (changing the hierarchy)
- Finally you run again and ... CRASSHHH.
yes, Hierarchy (inheritance) is supported but change it is not so simple to apply on existent file.
Somehow your class hierachy has changed -- which is not directly supported by db4o. What ever happend, you have the following options (from db4o docs):
- Create the new hierarchy with different names, preferably in a new package
- Copy all values from the old classes to the new classes.
- Redirect all references from existing objects to the new classes.
Okay this is what I did to remove the exception. I just created another clean database file. But I haven't find out what is the root cause that led to that error. No time for that yet. But it removed the "Unsupported class hierarchy change" exception. So if any of you encountered this you might want to try doing what I've done but if you know the root cause, please post it here as an answer. Thanks.
精彩评论