Skip to Content

Multi tenant in SAP Cloud Platform

Aug 15, 2017 at 10:22 AM


avatar image

I have created a Java ( JPA ) application which isolates data of different customers using the tenant id. I am aware that a schema based isolation and DB based isolation is also possible. How to enable this in the backend? Is there some sample/tutorial on this?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jin Wong
Aug 15, 2017 at 05:24 PM

Hi Thanu,

Please look at our help documentation.



If this question is answered from your perspective, then please clicked on the “Accept” link to complete this question.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Jin,

Thank you for the information.While using the API I am getting an error when fetching the tenant details. I am calling an instance of this call in an "ODataJPAServiceFactory" class implementation.

java.lang.ClassCastException: Cannot cast class to interface (found matching interface loaded by

public class TenantContextManager

public TenantContextManager() {
    // TODO Auto-generated constructor stub

public String getCurrentAccountId() throws ServletException {
    String currentAccountId;        
    try {
        InitialContext ctx = new InitialContext();
        TenantContext tenantctx = (TenantContext) ctx.lookup("java:comp/env/TenantContext");                

        currentAccountId = tenantctx.getTenant().getAccount().getId();                  

    } catch (Exception e) {
        throw new RuntimeException(e);
    return currentAccountId;        

Thanu Krishnan Kumaraswamy Aug 17, 2017 at 01:12 PM

Solved the issue. I changed the runtime from Java Web to Java EE 6 Web Profile. Looks like the API is not available in Java Web.

10 |10000 characters needed characters left characters exceeded