Connection Repository
Connection repository integrates with the spring data repository. This enables your application to lookup based on either the destiny or the originating DataEntry.
Definition
@Repository
public interface AuthoredConnectionRepository
extends NDBConnRepository<AuthoredConnection, String, BookDE, AuthorDE>{
}
This Repository definition contains not only the Connection (AuthoredConnection) but also the originating DataEntry (AuthorDE) and the destination DataEntry (BookDE).
Usage
@RestController
public class AnimeController{
@Autowired
AuthorRepository authorRepository;
@Autowired
AuthoredConnectionRepository authoredConnectionRepository;
@GetMapping("/authored/{name}")
public Set<AuthoredConnection> getByFrom(@PathVariable String name){
Optional<AuthorDE> byName = authorRepository.findByName(id);
if(byName.isPresent()){
return authoredConnectionRepository.getByFrom(byName.get());
}
return null;
}
}