I have a cassandra table with an associated materialized view.
The primary key is a single id of type uuid, and I have no sort key. Let's call it my_table_id
. This table contains a related_id
that I want to use to search.
Then I have a materialized view for that table defined as
PRIMARY KEY (related_id, my_table_id) WITH CLUSTERING ORDER BY (my_table_id ASC)
PS: I realise it's the wrong way to partition data in Cassandra, but unfortunately, this code was inherited.
I'm defining my table in my java code as:
@Table(table = "my_table")
public class MyTableType {
@PartitionKey
@Column("my_table_id")
@Codec(MyIdCassandraConverter.class)
CustomUUIDType myTableId;
@Column("related_id")
@Codec(MyRelatedIdCassandraConverter.class)
MyRelatedId relatedId;
(...)
}
Those two custom types are simply wrappers around UUIDs. Again, inherited.
My materialized view is defined as:
@MaterializedView(baseEntity = MyTableType.class, view = "my_table_by_related_id")
public class MyTableTypeByRelatedId {
@PartitionKey
@Column("related_id")
@Codec(MyRelatedIdCassandraConverter.class)
MyRelatedId relatedId;
@ClusteringColumn
@Column("my_table_id")
@Codec(MyIdCassandraConverter.class)
CustomUUIDType myTableId;
}
The code seems to be generated correctly, but when I start my Spring Boot application, I get:
Error:java: Cannot find base entity class 'mypackage.MyTableType' for view class 'mypackage.MyTableTypeByRelatedId' Error:java: Error while parsing: Cannot find base entity class 'mypackage.MyTableType' for view class 'mypackage.MyTableTypeByRelatedId'
There's some code generation going on, so it seems to be something's not generated correctly, but I can't quite figure out what.
The only mildly useful documentation I find is here and here, but none seems to offer help.
What am I doing wrong?
Well, not much of an answer, because this was not much of a question, but someone having a similar problem might find it useful.
This specific problem was caused because I was looking at the wrong database, which of course didn't have the tables and views I created. I had a property override file I thought was set correctly, and that was my mistake.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With