LEMUEL  ADANE
LEMUEL ADANE

Reputation: 8826

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 QueryByExample instruction throws an unsupported class hierarchy. Does anybody know what should I do?

Upvotes: 1

Views: 901

Answers (3)

Rodja
Rodja

Reputation: 8081

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.

Upvotes: 1

JairoV
JairoV

Reputation: 2104

It happened when you:

  1. Code a class and then run the program.
  2. Later you modify the code and add/change the parent class (changing the hierarchy)
  3. Finally you run again and ... CRASSHHH.

yes, Hierarchy (inheritance) is supported but change it is not so simple to apply on existent file.

Upvotes: 2

LEMUEL  ADANE
LEMUEL ADANE

Reputation: 8826

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.

Upvotes: 0

Related Questions