我可以通过JPA访问MySQL和MongoDB吗? [英] Can I access both MySQL and MongoDB with JPA?

查看:473
本文介绍了我可以通过JPA访问MySQL和MongoDB吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况是,我在MySQL中有一些付款交易数据,在MongoDB中有一些文件,例如发票文件.这两个数据存储之间没有关联需求.问题是,如何借助O/R映射支持同时访问它们.看来我们可以为MongoDB使用JPA.但是我不确定如何在同一应用程序中使用JPA api访问这两个数据存储.

My scenario is that I have some payment transaction data in MySQL and some documents like invoices documents in MongoDB. There are no association need between these two data store. The question is how I can access both of them at the same time with O/R Mapping support. It seems we can have JPA for MongoDB. But I'm not sure how we can access both data store with the JPA api in the same application.

谢谢!

推荐答案

EclipseLink(从2.​​4开始)具有对MySQL和MongoDB的JPA支持. EclipseLink还支持Composite Persistence UNits,它允许将多个持久性单元作为单个持久性单元进行访问,并允许它们之间建立关系.

EclipseLink (as of 2.4) has JPA support for both MySQL and MongoDB. EclipseLink also supports Composite Persistence UNits, that allows multiple persistence units to be accessed as a single persistence unit, and allows relationships across them.

这篇关于我可以通过JPA访问MySQL和MongoDB吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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