use of org.springframework.data.cassandra.core.mapping.EmbeddedEntityOperations in project spring-data-cassandra by spring-projects.
the class SchemaTestUtils method potentiallyCreateUdtFor.
private static void potentiallyCreateUdtFor(CassandraPersistentEntity<?> persistentEntity, CassandraOperations operations, SchemaFactory schemaFactory) {
if (persistentEntity.isUserDefinedType()) {
CreateUserTypeSpecification udtspec = schemaFactory.getCreateUserTypeSpecificationFor(persistentEntity).ifNotExists();
operations.getCqlOperations().execute(CreateUserTypeCqlGenerator.toCql(udtspec));
} else {
for (CassandraPersistentProperty property : persistentEntity) {
if (!property.isEntity()) {
continue;
}
if (property.isEmbedded()) {
potentiallyCreateUdtFor(new EmbeddedEntityOperations(operations.getConverter().getMappingContext()).getEntity(property), operations, schemaFactory);
} else {
potentiallyCreateUdtFor(operations.getConverter().getMappingContext().getRequiredPersistentEntity(property), operations, schemaFactory);
}
}
}
}
Aggregations