GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp

Spring Data Cloud Spanner missing @ReadOnlyProperty support

Open
#3,753 0 comments 0 reactions 0 assignees View on GitHub
priority: p2 type: enhancement
Dominant language
Java
Stars
551
Forks
349
Avg merge
1d 13h
Merged PRs (30d)
14

Description

spring-cloud-gcp-starter-data-spanner 5.11.2

Spring Data Cloud Spanner does not seem to have support for allowing a field of an entity to be populated from query results but prevent it from being written to the database.

This capability is needed for fields that are derived from queries (e.g., computed columns or subquery results) and should not be modified or saved.

Spring Data has the @ReadOnlyProperty which does just that and should be a supported feature.

Example
```
SELECT
foo.*,
EXISTS (
SELECT 1
FROM foo as bar
WHERE bar.external_id = foo.id
) as has_bar
FROM
foo
WHERE
foo.name = @fooName
```

In this case we want the data mapping to populate `has_bar` on our entity when issuing a query but to ignore `has_bar` when inserting or updating the entity (since has_bar is not a real column).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.