I am building a CRUD application where I am using spring data jpa to work with Database. I don't want to give schema name in my entity class, like mentioned below.
@Entity
@Table(name = "PROPERTY",schema = "ABC")
public class PropertyDTO extends BaseDTO{
//all the properties and getter,setters
}
When I will fetch any results using Repository, if I don't provide the schema name in My Entity class, it will throw an error, saying invalid object name PROPERTY, is there any other way where I can mention schema name and Framework will append the schema name while firing query?
If you need to change the schema name at the runtime, I recommend to use Hibernate multi-tenancy approach. You could find more details here and here