1

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?

LEMUEL ADANE
  • 8,336
  • 16
  • 58
  • 72
  • 1
    Have ever changed the inheritance hierarchy? Because db4o doesn't support that. And this exception is thrown when db4o detects that the class hierarchy has changed. – Gamlor Jan 17 '11 at 11:35
  • @Gamlor I do not remember changing the inheritance hierarchy. – LEMUEL ADANE Jan 18 '11 at 05:25

3 Answers3

2

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.

1

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.
Rodja
  • 7,998
  • 8
  • 48
  • 55
0

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.

LEMUEL ADANE
  • 8,336
  • 16
  • 58
  • 72