what is the best way to externalize the schema name attribute from @Table annotation from the entities

what is the best way to externalize the schema name attribute from @Table annotation from the entities, specifically when connecting to oracle database? I am looking for the elegant/best answer.

Add Comment
1 Answer(s)

Add following script to .sql file which needs add to resources folder

ALTER SESSION SET CURRENT_SCHEMA=NEW;

Do following changes to auto config file

Resource schema = new ClassPathResource("new.sql");
DatabasePopulator databasePopulator = new ResourceDatabasePopulator(schema);
DatabasePopulatorUtils.execute(databasePopulator, ds);
return ds;
Answered on February 6, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.