How do I ignore an entity field in Spring Data Cassandra? Using the javax.persistence.Transient
annotation?
Try annotating your transient fields with
org.springframework.data.annotation.Transient
and report back whether that works.
So, I wrote a test adding three fields:
@javax.persistence.Transient
private Boolean one;
@org.springframework.data.annotation.Transient
private Boolean two;
private Boolean three;
to an entity to Cassandra. Result:
one
was populated.two
was not populated.three
was populated. (just a check that I got my changes through)Conclusion:
javax.persistence.Transient
will not ignore a field.org.springframework.data.annotation.Transient
will ignore a field.If it does, you get bonus points for creating a test for it and sending a pull request!
Sorry, I'm on a tight schedule and don't know the code well enough. Created a JIRA ticket, though!
I don't recall explicitly coding this into spring-data-cassandra, but that behavior might just be provided entirely by spring-data-commons. I don't have time right now to create a test for that, though.
Try annotating your transient fields with org.springframework.data.annotation.Transient
and report back whether that works. If it does, you get bonus points for creating a test for it and sending a pull request! :)
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