Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private Expression detectExpression() {

@Override
public void addPersistentProperty(SpannerPersistentProperty property) {
if (!property.isMapped()) {
if (!property.isMapped() || !property.isWritable()) {
return;
}
addPersistentPropertyToPersistentEntity(property);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.data.annotation.ReadOnlyProperty;
import org.springframework.core.NestedExceptionUtils;
import org.springframework.data.core.TypeInformation;
import org.springframework.data.mapping.PersistentProperty;
Expand Down Expand Up @@ -225,11 +226,15 @@ void testIgnoredProperty() {
t.id = "a";
t.something = "a";
t.notMapped = "b";
t.readOnly = "c";
SpannerPersistentEntity p = new SpannerMappingContext().getPersistentEntity(TestEntity.class);
PersistentPropertyAccessor accessor = p.getPropertyAccessor(t);
p.doWithProperties(
(SimplePropertyHandler)
property -> assertThat(accessor.getProperty(property)).isNotEqualTo("b"));
property -> {
assertThat(accessor.getProperty(property)).isNotEqualTo("b");
assertThat(accessor.getProperty(property)).isNotEqualTo("c");
});
}

@Test
Expand Down Expand Up @@ -484,6 +489,9 @@ private static class TestEntity {
String something;

@NotMapped String notMapped;

@ReadOnlyProperty
String readOnly;
}

private static class EntityNoCustomName {
Expand Down