diff --git a/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java b/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java index 4f3df45ead1..b6690e229a9 100644 --- a/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java +++ b/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java @@ -209,7 +209,7 @@ protected void persist(String dn, String[] objectClasses, List at resultAttributes.add(new AttributeData(SqlOperationService.DN, dn)); resultAttributes.add(new AttributeData(SqlOperationService.DOC_ID, parsedKey.getKey())); - boolean result = getOperationService().addEntry(parsedKey.getKey(), getBaseObjectClass(objectClasses), resultAttributes); + boolean result = getOperationService().addEntry(parsedKey.getKey(), getBaseObjectClassForDataOperation(objectClasses), resultAttributes); if (!result) { throw new EntryPersistenceException(String.format("Failed to persist entry: '%s'", dn)); } @@ -266,7 +266,7 @@ public void merge(String dn, String[] objectClasses, List 0) { - boolean result = getOperationService().updateEntry(toSQLKey(dn).getKey(), getBaseObjectClass(objectClasses), modifications); + boolean result = getOperationService().updateEntry(toSQLKey(dn).getKey(), getBaseObjectClassForDataOperation(objectClasses), modifications); if (!result) { throw new EntryPersistenceException(String.format("Failed to update entry: '%s'", dn)); } @@ -988,6 +988,14 @@ protected boolean isSupportForceUpdate() { return true; } + private String getBaseObjectClassForDataOperation(String[] objectClasses) { + if (ArrayHelper.isNotEmpty(objectClasses) && objectClasses.length > 0) { + throw new MappingException("SQL ORM supports only one OC!"); + } + + return getBaseObjectClass(objectClasses); + } + private String getBaseObjectClass(String[] objectClasses) { if (ArrayHelper.isEmpty(objectClasses)) { throw new MappingException("Object class isn't defined!");