use of org.springframework.data.mapping.PersistentProperty in project spring-cloud-gcp by spring-cloud.
the class SpannerMutationFactoryImpl method delete.
@Override
public <T> Mutation delete(Class<T> entityClass, Iterable<? extends T> entities) {
SpannerPersistentEntity<?> persistentEntity = this.spannerMappingContext.getPersistentEntity(entityClass);
KeySet.Builder builder = KeySet.newBuilder();
for (T entity : entities) {
PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(entity);
PersistentProperty idProperty = persistentEntity.getIdProperty();
Key value = (Key) accessor.getProperty(idProperty);
builder.addKey(value);
}
return delete(entityClass, builder.build());
}
use of org.springframework.data.mapping.PersistentProperty in project spring-data-commons by spring-projects.
the class AnnotationBasedPersistentPropertyUnitTests method getRequiredAnnotationReturnsAnnotation.
// DATACMNS-1141
@Test
public void getRequiredAnnotationReturnsAnnotation() {
PersistentProperty property = getProperty(Sample.class, "id");
assertThat(property.getRequiredAnnotation(Id.class)).isNotNull();
}
use of org.springframework.data.mapping.PersistentProperty in project spring-data-commons by spring-projects.
the class AnnotationBasedPersistentPropertyUnitTests method getRequiredAnnotationThrowsException.
// DATACMNS-1141
@Test
public void getRequiredAnnotationThrowsException() {
PersistentProperty property = getProperty(Sample.class, "id");
assertThatThrownBy(() -> property.getRequiredAnnotation(Transient.class)).isInstanceOf(IllegalStateException.class);
}
use of org.springframework.data.mapping.PersistentProperty in project spring-data-commons by spring-projects.
the class AbstractPersistentPropertyUnitTests method doesNotDiscoverGetterAndSetterIfNoPropertyDescriptorGiven.
// DATACMNS-206
@Test
public void doesNotDiscoverGetterAndSetterIfNoPropertyDescriptorGiven() {
Field field = ReflectionUtils.findField(AccessorTestClass.class, "id");
Property property = Property.of(ClassTypeInformation.from(AccessorTestClass.class), field);
PersistentProperty<SamplePersistentProperty> persistentProperty = new SamplePersistentProperty(property, getEntity(AccessorTestClass.class), typeHolder);
assertThat(persistentProperty.getGetter()).isNull();
assertThat(persistentProperty.getSetter()).isNull();
}
Aggregations