I have a Spring based project where we turn of features using database flags.
This approach works great when turn on/off new logic. We run into issues when making database changes. In our testing environment we made have different columns in a given database table, than the table in the production environment.
For example: Let say we have a column FIELD_IN_TEST_ENV_ONLY
in our testing env only.
@Column(name = "FIELD_IN_TEST_ENV_ONLY")
private String myField;
When using a JPA repo.
this.repo.findAll()
The line above will fail if run in an enviroment with out the FIELD_IN_TEST_ENV_ONLY
column since hibernate will have a column in the select statement that does not exist
So basically I would like to implment something like the following...
if(MY_FLAG)
@Column(name = "FIELD_IN_TEST_ENV_ONLY")
else
@Transient
private String myField;
I'm just not sure how to implment something like this.