0

There is a property in spring batch for setting the default schema spring.jpa.properties.hibernate.default_schema=ABC Now this is my entity

@Table("EMPLOYEE")
class Employee{
}

This table is present in schema = DEF and this class is not in my repo and it is coming from another dependency. So I cant add the schema in @Table annotation.
So while inserting the query is

em.persist(employee);
insert into ABC.EMPLOYEE VALUES();

and the table is present in dEF. How do i pass the schema name while doing em.persist? for em the default schema is ABC

Daniel Jacob
  • 1,455
  • 9
  • 17
  • @DanielJacob : even if I create EmployeeRepository implements JpaRepository, same issue would come? how would i override the default schema in jparepository – stephen fernandes Aug 25 '20 at 14:07
  • Please try this - [multiple schemas usage](https://stackoverflow.com/questions/50760964/how-to-use-multiple-schemas-in-one-database-by-using-jpa-hibernate-with-sprin) – Dinesh Dontha Aug 25 '20 at 16:41
  • @DineshDontha i would prefer single PlatformTxnmanager . But the example there maintains or creates 2 transctionmanagers – stephen fernandes Aug 25 '20 at 18:37

0 Answers0