AnsweredAssumed Answered

Transaction didn't commit: Hibernate operation: Could ...

Question asked by edo.v on Oct 2, 2006
I have a problem with Alfresco Web Client.
Until I access through Web Client, I build an user with JCR API.
This is the code:

try {
  Node root = jcrSession.getRootNode();
  Node systemNode = root.getNode("sys:system");
  Node peopleNode = systemNode.getNode("sys:people");

  Node userNode = peopleNode.addNode("cm:person", "cm:person");
  userNode.setProperty("cm:name", "edo");
  userNode.setProperty("cm:userName", "edo");
  userNode.setProperty("cm:firstName", "Edoardo");
  userNode.setProperty("cm:lastName", "Vencia");
  userNode.setProperty("cm:email", "");
  userNode.setProperty("cm:owner", "System");
  userNode.setProperty("cm:homeFolder", root.getNode("app:company_home"));

  RepositoryImpl repositoryImpl = (RepositoryImpl) jcrSession.getRepository();

  // ensure the user can access their own Person object
  PermissionService permissionService = repositoryImpl.getServiceRegistry().getPermissionService();
  NodeRef userNodeRef = JCRNodeRef.getNodeRef(userNode);
  permissionService.setPermission(userNodeRef, "edo", PermissionService.CONSUMER, true);

  // Creo un'istanza ACEGI Authentication per il nuovo User
  AuthenticationService authenticationService = repositoryImpl.getServiceRegistry().getAuthenticationService();
  authenticationService.createAuthentication("edo", "pass".toCharArray());;"$$$ Creato l'User: " + "edo" + " $$$");
  } catch (RepositoryException e) {
  throw new AlfrescoException("RepositoryException: ", e);

And this is the problem that go out when I access to Alfresco (for the first time) through Web Client:

A system error happened during the operation: Transaction didn't commit: Hibernate operation: Could not execute JDBC batch update; SQL [insert into child_assoc (type_qname, qname, isPrimary, assoc_index, parent_protocol, parent_identifier, parent_guid, child_protocol, child_identifier, child_guid, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; Duplicate entry '374' for key 1; nested exception is java.sql.BatchUpdateException: Duplicate entry '374' for key 1

Can you help me?
I'm desperate!

Thank you very much!