question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for foreign key/joins in Spring Data Cloud Spanner

See original GitHub issue

Is your feature request related to a problem? Please describe. The documentation for Spring Data for Cloud Spanner claims that foreign key constraints are not natively supported in cloud spanner. Yet according to this documentation, they are supported. While it seems interleaving is the ideal solution for one-to-many relationships, foreign keys are necessary for many-to-many relationships and sometimes for one-to-one. However it seems to ORM mapping annotations for spanner only supports @Interleaved. What’s the current suggested solution for mapping @OneToOne and @ManyToMany relationships?

Describe the solution you’d like Adding @OneToOne, @OneToMany, ManyToOne, and @ManyToMany mapping annotations to the com.google.cloud.spring.data.spanner.core.mapping package for cases where we want to use foreign keys rather than interleaving.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bowenjincommented, Nov 24, 2021

Ah thank you guys, the Hibernate dialect + Spring Data JPA seems like a suitable alternative. Though it would be awesome if Cloud Spanner Spring Data supported some annotations for foreign keys. Hope this feature request gets some interest!

0reactions
elefeintcommented, Sep 8, 2022

@2021H1030044G #874 is a better fit for a new contributor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Foreign keys | Cloud Spanner
Foreign keys allow you to define relationships between tables. Spanner ensures the data integrity of these relationships is maintained. Imagine you are the...
Read more >
159. Spring Data Cloud Spanner
Cloud Spanner does not support the foreign key constraint, though the parent-child key constraint enforces a similar requirement when used with interleaved ...
Read more >
How to implement bidirectional relationship in Spring Spanner?
Cloud Spanner currently doesn't offer a way to enforce foreign-key constraints between non-interleaved tables. You will have to enforce such ...
Read more >
Spring Cloud GCP
Spring Boot Starter for Google Cloud SQL; 5.3. Samples ... Does not use Span joins. ... Cloud Spanner does not support the foreign...
Read more >
Optimizing Distributed Joins: The Case of Google Cloud ...
Distributed joins are joins in distributed databases, where data from each ... Google Cloud Spanner, which is a fully-managed relational database service.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found