简体   繁体   English

在Spring-Data中分离存储库和实现

[英]Separating repository and implementation in Spring-Data

Given some abstract entity: 给定一些抽象实体:

public interface Person{

    long getID();

    String getFirstName();

    String getLastName();
}

And repository to work with this entity: 与该实体一起使用的存储库:

public interface PersonRepository {

    void save(Person person);

    Person findOne(long id);

}

I want to implement above repository with different technologies: MongoDB with Spring Data MongoDB, Jpa with Spring Data JPA and for example Cassandra with my own implementation of repository. 我想用不同的技术来实现上述存储库:使用Spring Data MongoDB的MongoDB,使用Spring Data JPA的Jpa以及例如我自己的存储库实现的Cassandra。 Can somebody point me on documentation about implementing own Spring Data module? 有人可以指出我有关实现自己的Spring Data模块的文档吗?

How can I use Spring Data concepts to use both existed solutions and create my own implementation? 如何使用Spring Data概念来使用现有解决方案和创建自己的实现? It will be great if you can provide simple example. 如果您能提供简单的例子,那就太好了。

There's already a module for Cassandra in the making, so I suggest to contact the maintainers and help out if you like to. 制作中已经有Cassandra模块了 ,所以我建议与维护人员联系,并在需要时提供帮助。 Other than that, most of the community driven modules have started by simply studying the existing modules and working their way backwards. 除此之外,大多数社区驱动的模块都是通过简单地研究现有模块并向后工作来开始的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM