Closed
Description
I have a table that has names like resource_key
, and the entity POJO is defined like this
@Table("resource_ref")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Uuid implements Serializable {
private static final long serialVersionUID = 1L;
@PrimaryKey
@Column("resource_key")
private String resourceKey;
@Column("resource_type")
private String resourceType;
@Column("resource_uuid")
private UUID uuid;
private boolean uuidAlreadyExists;
}
This causes Cassandra to complain that it can't find the column resourcekey
. I have gotten around this by defining a post-processor:
public class CassandraPostProcessor implements BeanPostProcessor {
public Object postProcessAfterInitialization(@NotNull Object bean, @NotNull String beanName) throws BeansException {
if (bean instanceof CassandraMappingContext context) {
context.setNamingStrategy(NamingStrategy.SNAKE_CASE);
return context;
}
return bean;
}
}
Is there something else I should be doing to make Spring respect the @Column
value attribute?