I have an application split into various services. Some of the services are reactive, built on webflux, others are just springboot (non-reactive) applications.
We have jdbc & r2dbc repositories which reference all of our database tables. For JDBC entities we use JPA annotations, and for r2dbc entities we use spring-data annotations...
Both reactive & non-reactive services reference the same database tables. I am trying to think of a way that we can maintain duplicate entity / repostiories, and enforce any changes made to those tables...
For example, if we add or remove a column from table A, we need to make changes in both the reactive & non-reactive versions of the entities, and in turn, possibly update the queries in the repository layer as well... I am trying to find a way to add some guardrails, so that it is not possible to accidentally change the reactive version of an entity / repostory, and miss the non-reactive version.
more specifically, say I have these two classes.. If I add a column into SomeSpringDataEntity I would want the build to fail, because the field is NOT also added to SomeJPAEntity..
Additionally, if queries are modified in either the R2DBCRespostory OR JpaRepository which are related to these two entities, then I would want to build to fail unless BOTH are modified in the same way..
import org.springframework.data.relational.core.mapping.Table
import org.springframework.data.relational.core.mapping.Column
@Table
public class SomeSpringDataEntity {
@Column("FIELD_A")
private String fieldA;
@Column("FIELD_B")
private String fieldB
}
import javax.persistence.Table
import javax.persistence.Column
@Table
public class SomeJPAEntity {
@Column("FIELD_A")
private String fieldA;
@Column("FIELD_B")
private String fieldB
}
I hope the question is clear. Any and ALL advice is greatly appreciated. Thanks!