Getting this exception while creating a Joget User from Excel Upload upto 12,000 Records
I am getting this exception
org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: Prepare: NO vote
There are 12,000 rows in excel file for each of them i have to create a joget user. So, I have a form on which there is a file upload and then I have attached a store binder on that form. After all the processing is done at the end this exception is thrown.
However, I tried with 3,000 records in Excel file and it uploads and works fine.
This is my create Joget function.
public boolean createJogetUser() {
boolean created = false;
try {
UserSecurity us = DirectoryUtil.getUserSecurity();
UserDao ud = (UserDao) AppUtil.getApplicationContext().getBean("userDao");
org.joget.directory.model.User user = new org.joget.directory.model.User();
user.setId(staff_id);
user.setUsername(staff_id);
user.setFirstName(staff_name);
user.setEmail(staff_email);
user.setActive(1);
HashSet setRole = new HashSet();
Role role = new Role();
role.setId("ROLE_USER");
setRole.add(role);
user.setRoles(setRole);
HashSet setGroup = new HashSet();
Group group = new Group();
group.setId("staff");
setGroup.add(group);
user.setGroups(setGroup);
if (ud.getUserById(staff_id) != null) {
System.out.println("************User Already Exist " + staff_id);
return false;
}
ud.addUser(user);
created = true;
if (us != null) {
us.insertUserPostProcessing(user);
}
} catch (Exception e) {
System.out.println("--->>>>. ExceptiOn on User Creation Joget : " + e.toString());
}
return created;
}