Db4o不带持久化类的客户机/服务器模式:唯一约束/索引 [英] Db4o Client/Server Mode without persistent class : Unique Constraint / Indexes

查看:227
本文介绍了Db4o不带持久化类的客户机/服务器模式:唯一约束/索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从文档中不清楚如果一个db4o服务器在java 没有持久化类可以处理unicity约束,我没有看到没有,但是在服务器上配置它的方式,我们需要类在类路径。

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).

相同的索引问题?

感谢

推荐答案

我的建议:不要做没有持久化类的db4o服务器。这导致无数的问题。

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"));

这篇关于Db4o不带持久化类的客户机/服务器模式:唯一约束/索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆