'Java - Write Custom Annotation to make the field transient based on conition
I have an entity class in which I would want to mark the field transient based on some condition
Class TestEntity{
@column(name="col1")
private col1;
@column(name="col2")
private col2;
@column(name="col3")
private col3;
// Getter and Setters
}
During some cases I would want to read col3 from database while on few cases, I would want to populate col3 from other data source so in such case I would want to mark col3 as transient.
How do I achieve this? Can we have custom annotation to achieve this or any other elegant way to solve this problem?
Thank you in advance !!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
