Search code examples
springhibernatemulti-tenantspring-data-rest

why spring data rest disabled some hibernate features


i have been working with spring data jpa on a multi-tenant project and i used an http header to route data correctly between tenants with the help of hibernate (using MultiTenantConnectionProvider and CurrentTenantIdentifierResolver) but when i switched to spring data rest and used its endpoints all the data goes to public schema why the routing does not work anymore ? does spring data rest uses hibernate ?

here are my dependencies

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>



Solution

  • Spring Data REST works with JPA instead of hibernate directly. If you need vendor specific feature, just don't use Spring Data REST and implement the CRUD HTTP API yourself.