You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/07/13 13:30:31 UTC

svn commit: r1361165 - in /incubator/syncope/trunk/core: ./ src/main/java/org/apache/syncope/core/persistence/openjpa/ src/main/resources/ src/main/webapp/WEB-INF/ src/test/resources/jboss/

Author: ilgrosso
Date: Fri Jul 13 11:30:31 2012
New Revision: 1361165

URL: http://svn.apache.org/viewvc?rev=1361165&view=rev
Log:
[SYNCOPE-109] Adding (temporary) JBossPersistenceMappingFactory

Added:
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java   (with props)
Removed:
    incubator/syncope/trunk/core/src/test/resources/jboss/persistence.properties
Modified:
    incubator/syncope/trunk/core/pom.xml
    incubator/syncope/trunk/core/src/main/resources/persistenceContextEMFactory.xml
    incubator/syncope/trunk/core/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
    incubator/syncope/trunk/core/src/test/resources/jboss/persistenceContextEMFactory.xml

Modified: incubator/syncope/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/pom.xml?rev=1361165&r1=1361164&r2=1361165&view=diff
==============================================================================
--- incubator/syncope/trunk/core/pom.xml (original)
+++ incubator/syncope/trunk/core/pom.xml Fri Jul 13 11:30:31 2012
@@ -547,7 +547,7 @@ under the License.
               <cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
               <cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
 
-<!--                            <cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs>-->
+              <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs>-->
               <cargo.jvmargs>-noverify ${javaagent} -Drebel.spring_plugin=false -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
             </properties>
             <configfiles>
@@ -636,7 +636,7 @@ under the License.
           <exclude>oracle/**</exclude>
           <exclude>postgres/**</exclude>
           <exclude>mysql/**</exclude>
-          <exclude>glassfish/**</exclude>
+          <exclude>sqlserver/**</exclude>
           <exclude>jboss/**</exclude>
         </excludes>
       </testResource>
@@ -1057,10 +1057,8 @@ under the License.
       
       <dependencies>
         <dependency>
-          <groupId>org.apache.syncope</groupId>
-          <artifactId>syncope-hibernate-enhancer</artifactId>
-          <version>${project.version}</version>
-          <scope>provided</scope>
+          <groupId>org.apache.openjpa</groupId>
+          <artifactId>openjpa-all</artifactId>
         </dependency>
 
         <dependency>
@@ -1078,45 +1076,6 @@ under the License.
         <defaultGoal>clean verify</defaultGoal>
 
         <plugins>
-
-          <plugin>
-            <groupId>org.apache.openjpa</groupId>
-            <artifactId>openjpa-maven-plugin</artifactId>
-            <inherited>true</inherited>
-            <executions>
-              <execution>
-                <id>enhancer</id>
-                <phase>none</phase>
-              </execution>
-            </executions>
-          </plugin>
-
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>exec-maven-plugin</artifactId>
-            <inherited>true</inherited>
-            <configuration>
-              <classpathScope>compile</classpathScope>
-            </configuration>
-            <executions>
-              <execution>
-                <id>enhance-hibernate</id>
-                <phase>test-compile</phase>
-                <goals>
-                  <goal>exec</goal>
-                </goals>
-                <configuration>
-                  <executable>java</executable>
-                  <arguments>
-                    <argument>-classpath</argument>
-                    <classpath />
-                    <argument>org.apache.syncope.hibernate.HibernateEnhancer</argument>
-                    <argument>${project.build.directory}/classes</argument>
-                  </arguments>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
           
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
@@ -1165,6 +1124,7 @@ under the License.
             <directory>src/main/resources</directory>
             <filtering>true</filtering>
             <excludes>
+              <exclude>persistence.properties</exclude>
               <exclude>persistenceContextEMFactory.xml</exclude>
             </excludes>
           </resource>
@@ -1173,26 +1133,16 @@ under the License.
             <filtering>true</filtering>
             <includes>
               <include>persistenceContextEMFactory.xml</include>
-              <include>persistence.properties</include>
             </includes>
           </resource>
-        </resources>
-        <testResources>
-          <testResource>
+          <resource>
             <directory>src/test/resources</directory>
             <filtering>true</filtering>
-            <excludes>
-              <exclude>persistence.properties</exclude>
-            </excludes>
-          </testResource>
-          <testResource>
-            <directory>src/test/resources/jboss</directory>
-            <filtering>true</filtering>
             <includes>
               <include>persistence.properties</include>
-            </includes>
-          </testResource>
-        </testResources>
+            </includes>            
+          </resource>
+        </resources>
       </build>
     </profile>
     

Added: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java?rev=1361165&view=auto
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java (added)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java Fri Jul 13 11:30:31 2012
@@ -0,0 +1,318 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.openjpa;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import org.apache.openjpa.conf.OpenJPAConfiguration;
+import org.apache.openjpa.conf.OpenJPAConfigurationImpl;
+import org.apache.openjpa.lib.meta.ClassArgParser;
+import org.apache.openjpa.lib.meta.ClasspathMetaDataIterator;
+import org.apache.openjpa.lib.meta.FileMetaDataIterator;
+import org.apache.openjpa.lib.meta.JarFileURLMetaDataIterator;
+import org.apache.openjpa.lib.meta.MetaDataIterator;
+import org.apache.openjpa.lib.meta.ResourceMetaDataIterator;
+import org.apache.openjpa.lib.meta.URLMetaDataIterator;
+import org.apache.openjpa.lib.meta.ZipFileMetaDataIterator;
+import org.apache.openjpa.lib.meta.ZipStreamMetaDataIterator;
+import org.apache.openjpa.lib.util.J2DoPrivHelper;
+import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.persistence.PersistenceMetaDataFactory;
+import org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory;
+
+/**
+ * Temporary class used while issue OPENJPA-2229 gets fixed and reaches mainstream distribution.
+ */
+public class JBossPersistenceMappingFactory extends PersistenceMappingFactory {
+
+    private static final Localizer _loc = Localizer.forPackage(PersistenceMetaDataFactory.class);
+
+    /**
+     * Scan for persistent type names using the given metadata iterator.
+     */
+    private void scan(MetaDataIterator mitr, ClassArgParser cparser, Set names,
+            boolean mapNames, Object debugContext)
+            throws IOException {
+        Map map;
+        try {
+            map = cparser.mapTypeNames(mitr);
+        } finally {
+            mitr.close();
+        }
+
+        Map.Entry entry;
+        for (Iterator itr = map.entrySet().iterator(); itr.hasNext();) {
+            entry = (Map.Entry) itr.next();
+            if (mapNames) {
+                mapPersistentTypeNames(entry.getKey(), (String[]) entry.getValue());
+            }
+            List newNames = Arrays.asList((String[]) entry.getValue());
+            if (log.isTraceEnabled()) {
+                log.trace(_loc.get("scan-found-names", newNames, debugContext));
+            }
+            names.addAll(newNames);
+        }
+    }
+
+    /**
+     * Parse persistent type names.
+     */
+    @Override
+    protected Set<String> parsePersistentTypeNames(ClassLoader loader)
+            throws IOException {
+        
+        ClassArgParser cparser = newClassArgParser();
+        String[] clss;
+        Set<String> names = new HashSet<String>();
+        if (files != null) {
+            File file;
+            for (Iterator itr = files.iterator(); itr.hasNext();) {
+                file = (File) itr.next();
+                if ((AccessController.doPrivileged(J2DoPrivHelper.isDirectoryAction(file))).booleanValue()) {
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scanning-directory", file));
+                    }
+                    scan(new FileMetaDataIterator(file, newMetaDataFilter()), cparser, names, true, file);
+                } else if (file.getName().endsWith(".jar")) {
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scanning-jar", file));
+                    }
+                    try {
+                        ZipFile zFile = AccessController.doPrivileged(J2DoPrivHelper.newZipFileAction(file));
+                        scan(new ZipFileMetaDataIterator(zFile, newMetaDataFilter()), cparser, names, true, file);
+                    } catch (PrivilegedActionException pae) {
+                        throw (IOException) pae.getException();
+                    }
+                } else {
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scanning-file", file));
+                    }
+                    clss = cparser.parseTypeNames(new FileMetaDataIterator(file));
+                    List<String> newNames = Arrays.asList(clss);
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scan-found-names", newNames, file));
+                    }
+                    names.addAll(newNames);
+                    File f = AccessController.doPrivileged(J2DoPrivHelper.getAbsoluteFileAction(file));
+                    try {
+                        mapPersistentTypeNames(AccessController.doPrivileged(J2DoPrivHelper.toURLAction(f)), clss);
+                    } catch (PrivilegedActionException pae) {
+                        throw (FileNotFoundException) pae.getException();
+                    }
+                }
+            }
+        }
+        URL url;
+        if (urls != null) {
+            for (Iterator itr = urls.iterator(); itr.hasNext();) {
+                url = (URL) itr.next();
+                if ("file".equals(url.getProtocol())) {
+                    File file = AccessController.doPrivileged(J2DoPrivHelper.getAbsoluteFileAction(
+                            new File(url.getFile())));
+                    if (files != null && files.contains(file)) {
+                        continue;
+                    } else if ((AccessController.doPrivileged(J2DoPrivHelper.isDirectoryAction(file))).booleanValue()) {
+                        if (log.isTraceEnabled()) {
+                            log.trace(_loc.get("scanning-directory", file));
+                        }
+                        scan(new FileMetaDataIterator(file, newMetaDataFilter()), cparser, names, true, file);
+                        continue;
+                    }
+                }
+                // OPENJPA-2229 - begin
+                if ("vfs".equals(url.getProtocol())) {
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scanning-vfs-url", url));
+                    }
+
+                    URLConnection conn = url.openConnection();
+                    Object vfsContent = conn.getContent();
+                    try {
+                        Class virtualFileClass = Class.forName("org.jboss.vfs.VirtualFile");
+                        Method getPhysicalFile = virtualFileClass.getDeclaredMethod("getPhysicalFile");
+                        File file = (File) getPhysicalFile.invoke(vfsContent);
+                        scan(new FileMetaDataIterator(file, newMetaDataFilter()), cparser, names, true, file);
+                    } catch (Exception e) {
+                        log.error(_loc.get("while-scanning-vfs-url", url), e);
+                    }
+
+                    continue;
+                }
+                // OPENJPA-2229 - end
+                if ("jar".equals(url.getProtocol())) {
+                    if (url.getPath().endsWith("!/")) {
+                        if (log.isTraceEnabled()) {
+                            log.trace(_loc.get("scanning-jar-url", url));
+                        }
+                        scan(new ZipFileMetaDataIterator(url, newMetaDataFilter()), cparser, names, true, url);
+                    } else {
+                        if (log.isTraceEnabled()) {
+                            log.trace(_loc.get("scanning-jar-url", url));
+                        }
+                        scan(new JarFileURLMetaDataIterator(url, newMetaDataFilter()), cparser, names, true, url);
+                    }
+                } else if (url.getPath().endsWith(".jar")) {
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scanning-jar-at-url", url));
+                    }
+                    try {
+                        InputStream is = (InputStream) AccessController.doPrivileged(
+                                J2DoPrivHelper.openStreamAction(url));
+                        scan(new ZipStreamMetaDataIterator(new ZipInputStream(is), newMetaDataFilter()),
+                                cparser, names, true, url);
+                    } catch (PrivilegedActionException pae) {
+                        throw (IOException) pae.getException();
+                    }
+                } else {
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scanning-url", url));
+                    }
+                    clss = cparser.parseTypeNames(new URLMetaDataIterator(url));
+                    List<String> newNames = Arrays.asList(clss);
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scan-found-names", newNames, url));
+                    }
+                    names.addAll(newNames);
+                    mapPersistentTypeNames(url, clss);
+                }
+            }
+        }
+        if (rsrcs != null) {
+            String rsrc;
+            MetaDataIterator mitr;
+            for (Iterator itr = rsrcs.iterator(); itr.hasNext();) {
+                rsrc = (String) itr.next();
+                if (rsrc.endsWith(".jar")) {
+                    url = AccessController.doPrivileged(
+                            J2DoPrivHelper.getResourceAction(loader, rsrc));
+                    if (url != null) {
+                        if (log.isTraceEnabled()) {
+                            log.trace(_loc.get("scanning-jar-stream-url", url));
+                        }
+                        try {
+                            InputStream is = (InputStream) AccessController.doPrivileged(
+                                    J2DoPrivHelper.openStreamAction(url));
+                            scan(new ZipStreamMetaDataIterator(new ZipInputStream(is), newMetaDataFilter()), cparser,
+                                    names, true, url);
+                        } catch (PrivilegedActionException pae) {
+                            throw (IOException) pae.getException();
+                        }
+                    }
+                } else {
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("scanning-resource", rsrc));
+                    }
+                    mitr = new ResourceMetaDataIterator(rsrc, loader);
+                    OpenJPAConfiguration conf = repos.getConfiguration();
+                    Map peMap = null;
+                    if (conf instanceof OpenJPAConfigurationImpl) {
+                        peMap = ((OpenJPAConfigurationImpl) conf).getPersistenceEnvironment();
+                    }
+                    URL puUrl = peMap == null ? null : (URL) peMap.get(PERSISTENCE_UNIT_ROOT_URL);
+                    List<String> mappingFileNames =
+                            peMap == null ? null : (List<String>) peMap.get(MAPPING_FILE_NAMES);
+                    List<URL> jars = peMap == null ? null : (List<URL>) peMap.get(JAR_FILE_URLS);
+                    String puUrlString = puUrl == null ? null : puUrl.toString();
+                    if (log.isTraceEnabled()) {
+                        log.trace(_loc.get("pu-root-url", puUrlString));
+                    }
+
+                    List<URL> mitrUrls = new ArrayList<URL>(3);
+                    while (mitr.hasNext()) {
+                        url = (URL) mitr.next();
+                        String urlString = url.toString();
+                        if (log.isTraceEnabled()) {
+                            log.trace(_loc.get("resource-url", urlString));
+                        }
+                        if (peMap != null) {
+                            //OPENJPA-2102: decode the URL to remove such things a spaces (' ') encoded as '%20'
+                            if (puUrlString != null && decode(urlString).indexOf(decode(puUrlString)) != -1) {
+                                mitrUrls.add(url);
+                            }
+                            if (mappingFileNames != null && !mappingFileNames.isEmpty()) {
+                                for (String mappingFileName : mappingFileNames) {
+                                    if (log.isTraceEnabled()) {
+                                        log.trace(_loc.get("mapping-file-name", mappingFileName));
+                                    }
+                                    if (urlString.indexOf(mappingFileName) != -1) {
+                                        mitrUrls.add(url);
+                                    }
+                                }
+                            }
+
+                            if (jars != null && !jars.isEmpty()) {
+                                for (URL jarUrl : jars) {
+                                    if (log.isTraceEnabled()) {
+                                        log.trace(_loc.get("jar-file-url", jarUrl));
+                                    }
+                                    if (urlString.indexOf(jarUrl.toString()) != -1) {
+                                        mitrUrls.add(url);
+                                    }
+                                }
+                            }
+                        } else {
+                            mitrUrls.add(url);
+                        }
+                    }
+                    mitr.close();
+
+                    for (Object obj : mitrUrls) {
+                        url = (URL) obj;
+                        clss = cparser.parseTypeNames(new URLMetaDataIterator(url));
+                        List<String> newNames = Arrays.asList(clss);
+                        if (log.isTraceEnabled()) {
+                            log.trace(_loc.get("scan-found-names", newNames, rsrc));
+                        }
+                        names.addAll(newNames);
+                        mapPersistentTypeNames(url, clss);
+                    }
+                }
+            }
+        }
+        if (cpath != null) {
+            String[] dirs = (String[]) cpath.toArray(new String[cpath.size()]);
+            scan(new ClasspathMetaDataIterator(dirs, newMetaDataFilter()), cparser, names, true, dirs);
+        }
+        if (types != null) {
+            names.addAll(types);
+        }
+
+        if (log.isTraceEnabled()) {
+            log.trace(_loc.get("parse-found-names", names));
+        }
+
+        return names;
+    }
+}

Propchange: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/openjpa/JBossPersistenceMappingFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/syncope/trunk/core/src/main/resources/persistenceContextEMFactory.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/persistenceContextEMFactory.xml?rev=1361165&r1=1361164&r2=1361165&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/persistenceContextEMFactory.xml (original)
+++ incubator/syncope/trunk/core/src/main/resources/persistenceContextEMFactory.xml Fri Jul 13 11:30:31 2012
@@ -36,7 +36,8 @@ under the License.
     </property>
     <property name="jpaPropertyMap">
       <map>
-        <!--<entry key="openjpa.Log" value="SQL=TRACE"/>-->
+        <!--<entry key="openjpa.Log" value="SQL=TRACE"/>
+        <entry key="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=80"/>-->
                 
         <entry key="openjpa.NontransactionalWrite" value="false"/>
         <entry key="openjpa.AutoDetach" value="close, commit, nontx-read, rollback"/>
@@ -50,7 +51,7 @@ under the License.
                                 
         <entry key="openjpa.DataCache" value="true" />
         <entry key="openjpa.QueryCache" value="true"/>
-        <entry key="openjpa.RemoteCommitProvider" value="sjvm" />
+        <entry key="openjpa.RemoteCommitProvider" value="sjvm"/>
       </map>
     </property>
   </bean>

Modified: incubator/syncope/trunk/core/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/webapp/WEB-INF/jboss-deployment-structure.xml?rev=1361165&r1=1361164&r2=1361165&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/webapp/WEB-INF/jboss-deployment-structure.xml (original)
+++ incubator/syncope/trunk/core/src/main/webapp/WEB-INF/jboss-deployment-structure.xml Fri Jul 13 11:30:31 2012
@@ -21,10 +21,10 @@ under the License.
 <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
   <deployment>
     <dependencies>
-      <module name="org.hibernate"/>
       <module name="org.apache.xalan"/>
     </dependencies>
     <exclusions>
+      <module name="org.hibernate"/>
       <module name="org.slf4j"/>
       <module name="org.slf4j.impl"/>
     </exclusions>

Modified: incubator/syncope/trunk/core/src/test/resources/jboss/persistenceContextEMFactory.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/resources/jboss/persistenceContextEMFactory.xml?rev=1361165&r1=1361164&r2=1361165&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/resources/jboss/persistenceContextEMFactory.xml (original)
+++ incubator/syncope/trunk/core/src/test/resources/jboss/persistenceContextEMFactory.xml Fri Jul 13 11:30:31 2012
@@ -23,44 +23,38 @@ under the License.
        http://www.springframework.org/schema/beans/spring-beans.xsd">
 
   <bean id="entityManagerFactory"
-          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
     <property name="persistenceXmlLocation" value="classpath*:META-INF/spring-persistence.xml"/>
     <property name="persistenceUnitName" value="syncopePersistenceUnit"/>
     <property name="dataSource" ref="dataSource"/>
     <property name="jpaVendorAdapter">
-      <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+      <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
         <property name="showSql" value="false"/>
         <property name="generateDdl" value="true"/>
         <property name="databasePlatform" value="${jpa.dialect}"/>
       </bean>
     </property>
-    <property name="persistenceUnitPostProcessors">
-      <list>
-        <bean class="org.apache.syncope.core.util.SpringPersistenceUnitPostProcessor">
-          <property name="locations">
-            <list>
-              <value>classpath:org/apache/syncope/core/persistence/beans/*.class</value>
-              <value>classpath:org/apache/syncope/core/persistence/beans/membership/*.class</value>
-              <value>classpath:org/apache/syncope/core/persistence/beans/role/*.class</value>
-              <value>classpath:org/apache/syncope/core/persistence/beans/user/*.class</value>
-            </list>
-          </property>
-        </bean>
-      </list>
-    </property>
     <property name="jpaPropertyMap">
       <map>
-        <entry key="hibernate.listeners.envers.autoRegister" value="false"/>
+        <!--<entry key="openjpa.Log" value="SQL=TRACE"/>
+        <entry key="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=80"/>-->
                 
-        <entry key="hibernate.order_inserts" value="true"/>
-        <entry key="hibernate.order_updates" value="true"/>
-        <entry key="hibernate.id.new_generator_mappings" value="true"/>
-        <entry key="hibernate.generate_statistics" value="false"/>
+        <entry key="openjpa.NontransactionalWrite" value="false"/>
+        <entry key="openjpa.AutoDetach" value="close, commit, nontx-read, rollback"/>
 
-        <!-- Second level cache -->
-        <entry key="hibernate.cache.use_second_level_cache" value="false"/>
-        <entry key="hibernate.cache.use_query_cache" value="false"/>
-        <entry key="hibernate.cache.use_minimal_puts" value="false"/>
+        <entry key="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
+        <entry key="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
+                
+        <entry key="openjpa.ReadLockLevel" value="none"/>
+        <entry key="openjpa.WriteLockLevel" value="write"/>
+        <entry key="openjpa.LockTimeout" value="30000"/>
+                                
+        <entry key="openjpa.DataCache" value="true" />
+        <entry key="openjpa.QueryCache" value="true"/>
+        <entry key="openjpa.RemoteCommitProvider" value="sjvm"/>
+        
+        <entry key="openjpa.MetaDataFactory"
+               value="org.apache.syncope.core.persistence.openjpa.JBossPersistenceMappingFactory(URLs=vfs:${project.build.directory}/cargo/configurations/jboss71x/deployments/${project.build.finalName}.war/WEB-INF/classes/, Resources=META-INF/orm.xml)"/>
       </map>
     </property>
   </bean>