Spring和混合SQL和NoSQL数据库 [英] Spring and Mixing SQL and NoSQL db

查看:126
本文介绍了Spring和混合SQL和NoSQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前的信息的答案鼓励我混合SQL和NoSQL数据库。



在应用程序上下文配置和DAO创建方面,两个数据库的最佳实践是什么?



让我们选择Derby作为SQL数据库,Cassandra作为另一个。我正在寻找的是例如。一个示例appcontext.xml,两个DAO,一个在Derby上实现CRUD,另一个在Cassandra和一个(不是两个)样本单元测试中同时使用两个DAO。


$

解决方案

尝试弹簧-data http://www.springsource.org/spring-data (介绍参考视频< a href =http://vimeo.com/19125841 =nofollow>此处)



我认为Spring Data JPA提供了一个存储库编程模型,以每个受管域对象的接口开始。也许我们可以切换或点域到不同的数据存储。我没有尝试过这个由自己。您可以检查春天开始-data-jpa



但是结合nosql和关系会很复杂。但是可以基于其隔离级别将某些类型的数据保存到一个存储中。我不确定多个数据存储可能的事务隔离。您可以将文档存储到一个存储,将关系数据存储到需要数据完整性的数据。


The answers to my previous post encouraged me mixing SQL and NoSQL db.

What is the best practice implementation of two databases in terms of application context configuration and DAO creation?

Let's choose Derby as the SQL db and Cassandra as the other one. What I am searching for is e.g. an example appcontext.xml, two DAOs, one implementing CRUD on Derby and the other one ond Cassandra and one (not two) sample unit test using both DAOs simultanously.

Tutorials, sample (maven ;-) ) projects, book recommenditions etc. welcome.

解决方案

Try spring-data http://www.springsource.org/spring-data (an introductory reference video here)

i think Spring Data JPA provides a repository programming model that starts with an interface per managed domain object. May be we can switch or point domain to different data stores. i haven't tried out this by myself. You can check getting-started-with-spring-data-jpa

but combining nosql and relational will be complex. but one can persist certain type of data into one store based on the its segregation level. i am not sure the transaction isolation possible for multiple data stores.say you store documents to one store and relational data to one which requires data integrity if needed.

这篇关于Spring和混合SQL和NoSQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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