use of org.springframework.data.relational.core.mapping.RelationalPersistentProperty in project spring-data-jdbc by spring-projects.
the class BasicJdbcPersistentPropertyUnitTests method detectsReverseColumnNameFromColumnAnnotation.
// DATAJDBC-331
@Test
public void detectsReverseColumnNameFromColumnAnnotation() {
String propertyName = "someList";
RelationalPersistentProperty listProperty = //
context.getRequiredPersistentEntity(//
WithCollections.class).getRequiredPersistentProperty(propertyName);
PersistentPropertyPathExtension path = getPersistentPropertyPath(DummyEntity.class, propertyName);
assertThat(listProperty.getKeyColumn()).isEqualTo(quoted("WITH_COLLECTIONS_KEY"));
assertThat(listProperty.getReverseColumnName(path)).isEqualTo(quoted("some_value"));
}
use of org.springframework.data.relational.core.mapping.RelationalPersistentProperty in project spring-data-jdbc by spring-projects.
the class BasicRelationalConverterUnitTests method shouldUseConvertingPropertyAccessor.
// DATAJDBC-235
@Test
@SuppressWarnings("unchecked")
void shouldUseConvertingPropertyAccessor() {
RelationalPersistentEntity<MyEntity> entity = (RelationalPersistentEntity) context.getRequiredPersistentEntity(MyEntity.class);
MyEntity instance = new MyEntity();
PersistentPropertyAccessor<MyEntity> accessor = converter.getPropertyAccessor(entity, instance);
RelationalPersistentProperty property = entity.getRequiredPersistentProperty("flag");
accessor.setProperty(property, "1");
assertThat(instance.isFlag()).isTrue();
}
Aggregations