[英]Object persistence without database mapping
I am looking for an advice on persisting Java objects without the need for database mapping. 我正在寻找关于持久化Java对象而不需要数据库映射的建议。 In simple (and silly) words I want to have JPA, but not be bothered by details of database structure: tables, columns, keys.
简而言之,我想拥有JPA,但又不想被数据库结构的细节所困扰:表,列,键。 Ideally what I would like to achieve is just defining Java classes, instantiating objects and persisting/retrieving these objects and their associations without any need for repeating entities/properties information anywhere else.
理想情况下,我想要实现的只是定义Java类,实例化对象并持久化/检索这些对象及其关联,而无需在其他任何地方重复实体/属性信息。 I know that there are various kinds of NOSQL databases, document databases, key-value storages and so on, but I have close-to-zero experience with anything other than flavors of RDBMSes and by simply reading descriptions and manuals of Cassandra, BerkeleyDB, MongoDB etc I am even unable to judge whether they support my use cases or not ;( So here are my requirements:
我知道有各种各样的NOSQL数据库,文档数据库,键值存储等等,但是我对RDBMS风格以外的任何事物都有接近于零的经验,只需阅读Cassandra,BerkeleyDB的描述和手册, MongoDB等我什至无法判断它们是否支持我的用例;(所以这是我的要求:
FROM Book b WHERE b.price < :allowedPrice AND b.author=:author
). FROM Book b WHERE b.price < :allowedPrice AND b.author=:author
)。 Actually from what I have read, it seems that some object database would be the best choice for me, for example DB4O or ObjectDB. 实际上,从我阅读的内容来看,似乎某些对象数据库对我来说是最佳选择,例如DB4O或ObjectDB。 Unfortunately, DB4O is dead, and license for ObjectDB seems to be a bit too demanding for me.
不幸的是,DB4O已经死了,而ObjectDB的许可证似乎对我来说要求太高了。 Maybe there are some possibilities I am not aware of to fulfill above requirements with something else, some NoSQL solution or some set of tools on top of 'regular' RDBMS.
也许有一些我可能不知道的可能性,可以通过其他方法,NoSQL解决方案或“常规” RDBMS之上的某些工具来满足上述要求。
Do you have any suggestions or advice? 您有什么建议或建议吗?
I decided to focus mainly on object DB solutions, and unfortunately I could not find many of them. 我决定主要关注对象数据库解决方案,但不幸的是我找不到很多。 I evaluated ObjectDB and I have to admit that it's the best persistence solution I happened to work with.
我评估了ObjectDB,我不得不承认这是我碰巧使用过的最佳持久性解决方案。
Pros: 优点:
orm.xml
, be gone!), DB schema evolution, moving data between column on schema updates... orm.xml
了!),数据库模式演变,在模式更新的列之间移动数据。 。 @OneToMany
, @ManyToMany
and others) are not required. @OneToMany
, @ManyToMany
等)就不需要了。 However you still need them if you need source compatibility between ObjectDB and JPA ORM. Cons: 缺点:
For me, ObjectDB seems to be exactly what I need, and I will evaluate it further to check other aspects, as performance, conformance to more obscure corners of JPA and possibility of easy replacement with ORM when needed, schema evolution, etc. 对我来说,ObjectDB似乎正是我所需要的,我将对其进行进一步评估,以检查其他方面,例如性能,对JPA更加晦涩的角落的符合性以及在需要时可以很容易地用ORM替换,模式演变等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.