Search code examples
indexingconstraintsuniquedb4o

Db4o Client/Server Mode without persistent class : Unique Constraint / Indexes


It's not clear for me from the documentation if a db4o server in java without persistent class can handle unicity constraint, I see nothing saying no, but the way to configure it on the server we need the class on the classpath. (and I don't want that in that case).

Same question for indexes ?

Thanks in advance.


Solution

  • My recommendation: Don't do a db4o server without the persistent classes available. That leads to countless issues.

    Anyway, you should be able to just specify the full qualified class-name as a string and it should work.

        config.objectClass("your.package.YourClass").objectField("id").indexed(true);
        config.add(new UniqueFieldValueConstraint("your.package.YourClass", "id"));