07-30-2023, 03:01 PM
I created entity which is annotated with `@Table` and it resembles my cassandra table. I can do save, get and everything without much problems.
My problem comes when I want to do something more exciting, like set consistency level or do if not exists insert or something like that. Basically there is annotation option for `@Table` where you can configure read and write consistency but what if you use Spring and set that through configuration file? I really like having external configuration for those things. Also how to do if not exists save?
I know that you can get `saveQuery` or `getQuery` as `Statement` and from it you can set consistency at least but it looks ugly, then you must take result set, do map and get your object.
Have two questions:
- Is there a better way of dynamically setting consistency level for object mapper actions both with accessor and entity?
- How to do if not exists save for mapped object?
My problem comes when I want to do something more exciting, like set consistency level or do if not exists insert or something like that. Basically there is annotation option for `@Table` where you can configure read and write consistency but what if you use Spring and set that through configuration file? I really like having external configuration for those things. Also how to do if not exists save?
I know that you can get `saveQuery` or `getQuery` as `Statement` and from it you can set consistency at least but it looks ugly, then you must take result set, do map and get your object.
Have two questions:
- Is there a better way of dynamically setting consistency level for object mapper actions both with accessor and entity?
- How to do if not exists save for mapped object?