Spring Data JPA 和 SimpleJPA/SimpleDB
我想知道是否可以指定 SimpleJPA 作为 Spring-Data-JPA 使用的持久性提供程序。我不是 JPA 专家,所以我希望这个问题不是愚蠢的。就像在 persistence.xml 中指定 SimpleJPA 的实体管理器工厂一样简单吗?我还没有在网上找到有人使用 Spring-Data-JPA 连接到 Amazon 的 SimpleDB,如果有人能给我指出正确的方向,我会很高兴。
I'm wondering if it is possible to specify SimpleJPA as the persistence provider used by Spring-Data-JPA. I'm not a JPA expert so I hope this question isn't silly. Is it as easy as just specifying SimpleJPA's entity manager factory in the persistence.xml? I have yet to find anywhere online where someone has used Spring-Data-JPA to connect to Amazon's SimpleDB, I would love it if someone could point me in the right direction.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚找到这个项目并让它满足我们的
Spring Data + SimpleDB
需求:https://github.com/3pillarlabs/spring-data-simpledb
该文档非常好,并且启动和运行非常简单。我通过 Spring Data 访问 SimpleDB,花费了大约 10 分钟的时间。
I just found this project and got it working for our
Spring Data + SimpleDB
needs:https://github.com/3pillarlabs/spring-data-simpledb
The documentation is pretty good and getting things up and running was pretty straight-forward. I was accessing SimpleDB via Spring Data with about 10 minutes of work.
一般来说,设置持久性提供程序只需通过 Spring 上下文设置 EntityManagerFactory(如果您使用 Spring 容器)。因此看看 如何在 Spring 中配置 EntityManagerFactory 实例。
可能需要实现自定义 JpaVendorAdapter 才能让 Spring 正确使用 SimpleDB JPA 实现。对于某些高级功能(例如使用手动定义的查询进行分页),我们必须稍微调整 Spring Data JPA 代码库。如果您想查看支持,请随时在我们的 JIRA 中开具票证。
Generally setting up your persistence provider is just a matter of setting up the
EntityManagerFactory
through your Spring context (in case you use the Spring container). Thus have a look at how to configureEntityManagerFactory
instances in Spring.There might be the need to implement a custom
JpaVendorAdapter
to let Spring use the SimpleDB JPA implementation correctly. For some advanced functionality (e.g. using pagination with manually defined queries) we'd have to tweak the Spring Data JPA codebase a bit. If you'd like to see that supported feel free to open a ticket in our JIRA.