I managed to migrate the project's code from driver version 3.x to 4.x using the mapper annotations.
However when process initializes the DAOs I get the error below.
It seems that the annotation processing auto generated code is expecting to locate the Campaign UDT fields as Profile entity columns.
2021-11-21 10:41:53,805 [localhost-startStop-1] FATAL esEngine.ProfilesEngineServlet - ProfilesEngineServlet Failed to init due to exception
java.lang.IllegalArgumentException: The CQL ks.table: proj.profile has missing columns: [partner_id, campaign_id] that are defined in the entity class: com.proj.bean.Campaign
at com.proj.bean.CampaignHelper__MapperGenerated.validateEntityFields(CampaignHelper__MapperGenerated.java:199)
at com.proj.cql3client.daoimpl.ProfileAccessorImpl__MapperGenerated.initAsync(ProfileAccessorImpl__MapperGenerated.java:1216)
at com.proj.cql3client.daoimpl.ProfileAccessorImpl__MapperGenerated.init(ProfileAccessorImpl__MapperGenerated.java:1710)
at com.proj.cql3client.MainDaoMapperImpl__MapperGenerated.lambda$profileAccessor$28(MainDaoMapperImpl__MapperGenerated.java:241)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at com.proj.cql3client.MainDaoMapperImpl__MapperGenerated.profileAccessor(MainDaoMapperImpl__MapperGenerated.java:241)
at com.proj.cql3client.daoimpl.ProfileDao.<init>(ProfileDao.java:67)
I have a profile entity containing a list of campaigns:
@Entity
@CqlName ("profile")
public class Profile {
...
@CqlName("campaigns")
private List<Campaign> campaigns;
...
}
Campaign is a user defined type:
@Entity
@CqlName ("campaign")
public class Campaign {
...
@CqlName("partner_id")
private int partnerId;
@CqlName("campaign_id")
private int campaignId;
...
}
In cassandra campaign type is defined:
CREATE TYPE campaign (
partner_id int,
campaign_id int
);
and the profile table is defined:
CREATE TABLE profile (
...
campaigns list<frozen<campaign>>,
...
)
Registering a codec didn't solve the problem.
Does anyone know how to solve this issue?
Thanks,
Shai