fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [1/7] incubator-fineract git commit: OpenJPA Integration Changes
Date Mon, 17 Oct 2016 08:19:21 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop 8d3f7af16 -> 9d7f1c219


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/template/domain/Template.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/template/domain/Template.java
b/fineract-provider/src/main/java/org/apache/fineract/template/domain/Template.java
index c5a066b..a76654b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/template/domain/Template.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/template/domain/Template.java
@@ -22,27 +22,19 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.OneToMany;
-import javax.persistence.OrderBy;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
+import javax.persistence.*;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.springframework.data.jpa.domain.AbstractPersistable;
 
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 
 @Entity
 @Table(name = "m_template", uniqueConstraints = {@UniqueConstraint(columnNames = {"name"},
name = "unq_name")})
-public class Template extends AbstractPersistable<Long> {
+public class Template extends AbstractPersistableCustom<Long> {
 
     @Column(name = "name", nullable = false, unique = true)
     private String name;
@@ -60,6 +52,10 @@ public class Template extends AbstractPersistable<Long> {
 
     @OrderBy(value = "mapperorder")
     @OneToMany(targetEntity = TemplateMapper.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+    @JoinTable(name="m_template_m_templatemappers",
+        joinColumns={@JoinColumn(name="m_template_id", referencedColumnName="id")},
+        inverseJoinColumns={@JoinColumn(name="mappers_id", referencedColumnName="id", unique=true)}
+    )
     private List<TemplateMapper> mappers;
 
     public Template(final String name, final String text,

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/template/domain/TemplateMapper.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/template/domain/TemplateMapper.java
b/fineract-provider/src/main/java/org/apache/fineract/template/domain/TemplateMapper.java
index 30ad335..6b034aa 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/template/domain/TemplateMapper.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/template/domain/TemplateMapper.java
@@ -22,11 +22,11 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;
 
-import org.springframework.data.jpa.domain.AbstractPersistable;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 
 @Entity
 @Table(name = "m_templatemappers")
-public class TemplateMapper extends AbstractPersistable<Long> {
+public class TemplateMapper extends AbstractPersistableCustom<Long> {
 
     @Column(name = "mapperorder")
     private int mapperorder;

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
index d52ede0..9c8a86f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
@@ -44,6 +44,7 @@ import javax.persistence.UniqueConstraint;
 import org.apache.fineract.infrastructure.core.api.JsonCommand;
 import org.apache.fineract.infrastructure.core.data.EnumOptionData;
 import org.apache.fineract.infrastructure.core.service.DateUtils;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 import org.apache.fineract.infrastructure.security.domain.PlatformUser;
 import org.apache.fineract.infrastructure.security.exception.NoAuthorizationException;
 import org.apache.fineract.infrastructure.security.service.PlatformPasswordEncoder;
@@ -54,14 +55,13 @@ import org.apache.fineract.portfolio.client.domain.Client;
 import org.apache.fineract.useradministration.service.AppUserConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.data.jpa.domain.AbstractPersistable;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.userdetails.User;
 
 @Entity
 @Table(name = "m_appuser", uniqueConstraints = @UniqueConstraint(columnNames = { "username"
}, name = "username_org"))
-public class AppUser extends AbstractPersistable<Long> implements PlatformUser {
+public class AppUser extends AbstractPersistableCustom<Long> implements PlatformUser
{
 
     private final static Logger logger = LoggerFactory.getLogger(AppUser.class);
 
@@ -84,10 +84,10 @@ public class AppUser extends AbstractPersistable<Long> implements
PlatformUser {
     private boolean accountNonExpired;
 
     @Column(name = "nonlocked", nullable = false)
-    private final boolean accountNonLocked;
+    private boolean accountNonLocked;
 
     @Column(name = "nonexpired_credentials", nullable = false)
-    private final boolean credentialsNonExpired;
+    private boolean credentialsNonExpired;
 
     @Column(name = "enabled", nullable = false)
     private boolean enabled;

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java
index f4119c4..a0aa2d7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java
@@ -25,11 +25,11 @@ import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 
 import org.apache.fineract.portfolio.client.domain.Client;
-import org.springframework.data.jpa.domain.AbstractPersistable;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 
 @Entity
 @Table(name = "m_selfservice_user_client_mapping")
-public class AppUserClientMapping extends AbstractPersistable<Long> {
+public class AppUserClientMapping extends AbstractPersistableCustom<Long> {
 	
     @ManyToOne(optional = false, cascade = CascadeType.PERSIST)
     @JoinColumn(name = "client_id", nullable = false)

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserPreviousPassword.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserPreviousPassword.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserPreviousPassword.java
index ebc61af..3b18e9c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserPreviousPassword.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserPreviousPassword.java
@@ -27,11 +27,11 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
 import org.apache.fineract.infrastructure.core.service.DateUtils;
-import org.springframework.data.jpa.domain.AbstractPersistable;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 
 @Entity
 @Table(name = "m_appuser_previous_password")
-public class AppUserPreviousPassword extends AbstractPersistable<Long> {
+public class AppUserPreviousPassword extends AbstractPersistableCustom<Long> {
 
     @Column(name = "user_id", nullable = false)
     private Long userId;

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicy.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicy.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicy.java
index f633f76..545c380 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicy.java
@@ -25,14 +25,11 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;
 
-import org.springframework.data.jpa.domain.AbstractPersistable;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 
 @Entity
 @Table(name = "m_password_validation_policy")
-public class PasswordValidationPolicy extends AbstractPersistable<Long> {
-
-    // private final static Logger logger =
-    // LoggerFactory.getLogger(PasswordValidationPolicy.class);
+public class PasswordValidationPolicy extends AbstractPersistableCustom<Long> {
 
     @Column(name = "regex", nullable = false)
     private String regex;

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicyRepository.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicyRepository.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicyRepository.java
index 79de60d..1fffec7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicyRepository.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/PasswordValidationPolicyRepository.java
@@ -25,7 +25,7 @@ import org.springframework.data.jpa.repository.Query;
 public interface PasswordValidationPolicyRepository extends JpaRepository<PasswordValidationPolicy,
Long>,
         JpaSpecificationExecutor<PasswordValidationPolicy> {
 
-    @Query("from PasswordValidationPolicy PVP WHERE PVP.active = 1")
+    @Query("select PVP from PasswordValidationPolicy PVP WHERE PVP.active = true")
     public PasswordValidationPolicy findActivePasswordValidationPolicy();
 
 

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java
index 10e8d55..8d636e4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Permission.java
@@ -22,23 +22,23 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;
 
-import org.springframework.data.jpa.domain.AbstractPersistable;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 
 @Entity
 @Table(name = "m_permission")
-public class Permission extends AbstractPersistable<Long> {
+public class Permission extends AbstractPersistableCustom<Long> {
 
     @Column(name = "grouping", nullable = false, length = 45)
-    private final String grouping;
+    private String grouping;
 
     @Column(name = "code", nullable = false, length = 100)
-    private final String code;
+    private String code;
 
     @Column(name = "entity_name", nullable = true, length = 100)
-    private final String entityName;
+    private String entityName;
 
     @Column(name = "action_name", nullable = true, length = 100)
-    private final String actionName;
+    private String actionName;
 
     @Column(name = "can_maker_checker", nullable = false)
     private boolean canMakerChecker;

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java
index fd27b5a..19b3d98 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/Role.java
@@ -34,12 +34,12 @@ import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
 
 import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 import org.apache.fineract.useradministration.data.RoleData;
-import org.springframework.data.jpa.domain.AbstractPersistable;
 
 @Entity
 @Table(name = "m_role", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" },
name = "unq_name") })
-public class Role extends AbstractPersistable<Long> {
+public class Role extends AbstractPersistableCustom<Long> {
 
     @Column(name = "name", unique = true, nullable = false, length = 100)
     private String name;
@@ -52,7 +52,7 @@ public class Role extends AbstractPersistable<Long> {
 
     @ManyToMany(fetch = FetchType.EAGER)
     @JoinTable(name = "m_role_permission", joinColumns = @JoinColumn(name = "role_id"), inverseJoinColumns
= @JoinColumn(name = "permission_id"))
-    private final Set<Permission> permissions = new HashSet<>();
+    private Set<Permission> permissions = new HashSet<>();
 
     public static Role fromJson(final JsonCommand command) {
         final String name = command.stringValueOfParameterNamed("name");

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/RoleRepository.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/RoleRepository.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/RoleRepository.java
index da9b68e..07e8305 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/RoleRepository.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/RoleRepository.java
@@ -25,7 +25,7 @@ import org.springframework.data.repository.query.Param;
 
 public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificationExecutor<Role>
{
 
-    @Query("SELECT COUNT(*) FROM AppUser a JOIN a.roles r WHERE r.id = :roleId AND a.deleted
= false")
+    @Query("SELECT COUNT(a) FROM AppUser a JOIN a.roles r WHERE r.id = :roleId AND a.deleted
= false")
     Integer getCountOfRolesAssociatedWithUsers(@Param("roleId") Long roleId);
   
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java
index a0089fb..acda463 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java
@@ -25,6 +25,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.persistence.EntityExistsException;
+import javax.persistence.PersistenceException;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.fineract.commands.service.CommandWrapperBuilder;
 import org.apache.fineract.infrastructure.core.api.JsonCommand;
 import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -60,6 +64,7 @@ import org.springframework.cache.annotation.Caching;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Sort;
+import org.springframework.security.authentication.AuthenticationServiceException;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
@@ -152,9 +157,15 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements
AppUserWrit
                     .withOfficeId(userOffice.getId()) //
                     .build();
         } catch (final DataIntegrityViolationException dve) {
-            handleDataIntegrityIssues(command, dve);
+            handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
             return CommandProcessingResult.empty();
-        } catch (final PlatformEmailSendException e) {
+        }catch (final PersistenceException | AuthenticationServiceException dve) {
+        	Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
+            handleDataIntegrityIssues(command, throwable, dve);
+            return new CommandProcessingResultBuilder() //
+                    .withCommandId(command.commandId()) //
+                    .build();
+        }catch (final PlatformEmailSendException e) {
             final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
 
             final String email = command.stringValueOfParameterNamed("email");
@@ -239,9 +250,14 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements
AppUserWrit
                     .with(changes) //
                     .build();
         } catch (final DataIntegrityViolationException dve) {
-            handleDataIntegrityIssues(command, dve);
-
+            handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
             return CommandProcessingResult.empty();
+        }catch (final PersistenceException | AuthenticationServiceException dve) {
+        	Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
+            handleDataIntegrityIssues(command, throwable, dve);
+            return new CommandProcessingResultBuilder() //
+                    .withCommandId(command.commandId()) //
+                    .build();
         }
     }
 
@@ -317,10 +333,8 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements
AppUserWrit
      * Guaranteed to throw an exception no matter what the data integrity issue
      * is.
      */
-    private void handleDataIntegrityIssues(final JsonCommand command, final DataIntegrityViolationException
dve) {
-
-        final Throwable realCause = dve.getMostSpecificCause();
-        if (realCause.getMessage().contains("username_org")) {
+    private void handleDataIntegrityIssues(final JsonCommand command, final Throwable realCause,
final Exception dve) {
+        if (realCause.getMessage().contains("'username_org'")) {
             final String username = command.stringValueOfParameterNamed("username");
             final StringBuilder defaultMessageBuilder = new StringBuilder("User with username
").append(username)
                     .append(" already exists.");

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java
index 21fa9e8..7b47332 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java
@@ -22,6 +22,9 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.persistence.PersistenceException;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.fineract.infrastructure.core.api.JsonCommand;
 import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
 import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
@@ -80,7 +83,13 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
 
             return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(entity.getId()).build();
         } catch (final DataIntegrityViolationException dve) {
-            handleDataIntegrityIssues(command, dve);
+            handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
+            return new CommandProcessingResultBuilder() //
+                    .withCommandId(command.commandId()) //
+                    .build();
+        }catch (final PersistenceException dve) {
+        	Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
+        	handleDataIntegrityIssues(command, throwable, dve);
             return new CommandProcessingResultBuilder() //
                     .withCommandId(command.commandId()) //
                     .build();
@@ -91,9 +100,8 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
      * Guaranteed to throw an exception no matter what the data integrity issue
      * is.
      */
-    private void handleDataIntegrityIssues(final JsonCommand command, final DataIntegrityViolationException
dve) {
+    private void handleDataIntegrityIssues(final JsonCommand command, final Throwable realCause,
final Exception dve) {
 
-        final Throwable realCause = dve.getMostSpecificCause();
         if (realCause.getMessage().contains("unq_name")) {
 
             final String name = command.stringValueOfParameterNamed("name");
@@ -106,7 +114,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
                 "Unknown data integrity issue with resource.");
     }
 
-    private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException
dve) {
+    private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
         logger.error(dve.getMessage(), dve);
     }
 
@@ -133,7 +141,13 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
                     .with(changes) //
                     .build();
         } catch (final DataIntegrityViolationException dve) {
-            handleDataIntegrityIssues(command, dve);
+            handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
+            return new CommandProcessingResultBuilder() //
+                    .withCommandId(command.commandId()) //
+                    .build();
+        }catch (final PersistenceException dve) {
+        	Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
+        	handleDataIntegrityIssues(command, throwable, dve);
             return new CommandProcessingResultBuilder() //
                     .withCommandId(command.commandId()) //
                     .build();

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/META-INF/persistence.xml b/fineract-provider/src/main/resources/META-INF/persistence.xml
index 65230b7..8b13301 100644
--- a/fineract-provider/src/main/resources/META-INF/persistence.xml
+++ b/fineract-provider/src/main/resources/META-INF/persistence.xml
@@ -26,11 +26,13 @@
 	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
 
 	<persistence-unit name="jpa-pu" transaction-type="RESOURCE_LOCAL">
-		<provider>org.hibernate.ejb.HibernatePersistence</provider>
-		<properties>
-			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"
/>
-			<property name="hibernate.jdbc.batch_size" value="100" />
-			<property name="hibernate.order_inserts" value="true" />
-		</properties>
+		<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+	<properties>
+        <property name="openjpa.Compatibility" value="QuotedNumbersInQueries=true"/>
+        <property name="openjpa.jdbc.DBDictionary" value="org.apache.fineract.infrastructure.core.domain.MySQLDictionaryCustom"/>
+        <!--<property name="openjpa.InverseManager" value="true(Action=warn)"/>
-->
+      <!-- <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO,
SQL=TRACE"/>-->
+       <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=CASCADE"/>
+	</properties>
 	</persistence-unit>
 </persistence>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/9d7f1c21/fineract-provider/src/main/resources/META-INF/spring/infrastructure.xml
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/META-INF/spring/infrastructure.xml b/fineract-provider/src/main/resources/META-INF/spring/infrastructure.xml
index ad8b418..e57daae 100644
--- a/fineract-provider/src/main/resources/META-INF/spring/infrastructure.xml
+++ b/fineract-provider/src/main/resources/META-INF/spring/infrastructure.xml
@@ -34,12 +34,7 @@
 		<property name="dataSource" ref="routingDataSource" />
 		<property name="persistenceUnitName" value="jpa-pu" />
 		<property name="jpaVendorAdapter">
-			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
-				<property name="database" value="MYSQL" />
-				<property name="showSql" value="false" />
-				<property name="generateDdl" value="false" />
-				<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
-			</bean>
+		   <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter"/>
 		</property>
 	</bean>
 


Mime
View raw message