When using JPA in Spring, I want to use a different table for each phase. In the example below, I would like to use "this-is-dev", "this-is-prod" table for each phase. All columns in the table and JPA repository methods are same. Is there a good way?
@Entity
@Table("this-is-dev") // for dev
// @Table("this-is-prod") //for prod
public class TestEntity {
@Id
private Long id;
// ... same columns
}
@Repository
public interface TestRepository extends JpaRepository<TestEntity, Long> {
// ... same methods
}
@Repository
@RequiredArgsConstructor
public class TestService {
private final TestRepository repository;
}