Problem importing Roles via entityImportExportService

Hi,

 String templateFileName = "test/com/platform/crm/data/production/Roles.json";
 String content = new String(Files.readAllBytes(Paths.get(templateFileName)));
 entityImportExportService.importEntitiesFromJSON(content  , new EntityImportView(Role.class));

I have this Roles.json (9.7 KB) exported from my system.
I am trying to import it and I get the following exception:

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.cuba24): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'NAME' cannot be null
Error Code: 1048
Call: INSERT INTO SEC_ROLE (ID, CREATE_TS, CREATED_BY, IS_DEFAULT_ROLE, DELETE_TS, DELETED_BY, DESCRIPTION, LOC_NAME, NAME, ROLE_TYPE, UPDATE_TS, UPDATED_BY, VERSION) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
	bind => [bec1d9be4ea2ec6a0b8a1a0c2c73c6f9, 2019-01-29 12:46:17.935, test_admin, null, null, null, null, null, null, null, 2019-01-29 12:46:17.935, null, 1]

All the role nodes in the JSON has “name” property.

Thanks

Hi,
you should provide a correct EntityImportView. Take a look how it is done in the RolesBrowser.java, see the createRolesImportView() method there. The information about using the EntityImportView is in the class javadoc.

1 Like