portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r751448 [2/3] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: components/jetspeed-capability/src/test/resources/ components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/ components/jetspeed-page-manager/src/mai...
Date Sun, 08 Mar 2009 15:45:23 GMT
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java Sun Mar  8 15:45:21 2009
@@ -493,6 +493,25 @@
         }
     }
 
+    public void removeAll(org.apache.jetspeed.om.portlet.PortletDefinition pd)
+    {
+        Criteria c = new Criteria();
+        c.addEqualTo("applicationName", pd.getApplication().getName());
+        c.addEqualTo("portletName", pd.getPortletName());                
+        QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c);
+        getPersistenceBrokerTemplate().deleteByQuery(query);
+        preferenceCache.clear();
+    }
+
+    public void removeAll(PortletApplication app)
+    {
+        Criteria c = new Criteria();
+        c.addEqualTo("applicationName", app.getName());
+        QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c);
+        getPersistenceBrokerTemplate().deleteByQuery(query);
+        preferenceCache.clear();            
+    }
+
     public Map<String, InternalPortletPreference> getDefaultPreferences(org.apache.jetspeed.om.portlet.PortletDefinition pd)
     {
         String appName = pd.getApplication().getName();

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreference.java Sun Mar  8 15:45:21 2009
@@ -50,9 +50,11 @@
 @Table (name="PORTLET_PREFERENCE")
 @NamedQueries ({@NamedQuery(name="PORTLET_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName and pp.portletName = :portletName"),
                 @NamedQuery(name="DELETE_PORTLET_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName and pp.portletName = :portletName"),
+                @NamedQuery(name="DELETE_ALL_PORTLET_PREFERENCES", query="select pp from PortletPreference pp where pp.applicationName = :applicationName and pp.portletName = :portletName"),
                 @NamedQuery(name="PORTLET_DTYPE_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype"),
                 @NamedQuery(name="PORTLET_APPLICATION_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName"),
                 @NamedQuery(name="DELETE_PORTLET_APPLICATION_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName"),
+                @NamedQuery(name="DELETE_ALL_PORTLET_APPLICATION_PREFERENCES", query="select pp from PortletPreference pp where pp.applicationName = :applicationName"),
                 @NamedQuery(name="FULLY_QUALIFIED_PORTLET_PREFERENCES", query="select pp from PortletPreference pp where pp.dtype = :dtype and pp.applicationName = :applicationName and pp.portletName = :portletName and pp.entityId = :entityId and pp.userName = :userName")})
 public class DatabasePreference implements InternalPortletPreference
 {

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValue.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValue.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValue.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValue.java Sun Mar  8 15:45:21 2009
@@ -48,7 +48,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=DatabasePreference.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="PREF_ID", referencedColumnName="ID")
+    @JoinColumn (name="PREF_ID", referencedColumnName="ID", nullable=false)
     private DatabasePreference pref;
     @Basic
     @Column (name="IDX")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValueCollection.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValueCollection.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValueCollection.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/DatabasePreferenceValueCollection.java Sun Mar  8 15:45:21 2009
@@ -59,36 +59,7 @@
      */
     public Iterator<DatabasePreferenceValue> iterator()
     {
-        return new Iterator<DatabasePreferenceValue>()
-        {
-            private Iterator<DatabasePreferenceValue> iter = collection.iterator();
-            private DatabasePreferenceValue lastNext = null;
-
-            /* (non-Javadoc)
-             * @see java.util.Iterator#hasNext()
-             */
-            public boolean hasNext()
-            {
-                return iter.hasNext();
-            }
-
-            /* (non-Javadoc)
-             * @see java.util.Iterator#next()
-             */
-            public DatabasePreferenceValue next()
-            {
-                return lastNext = iter.next();
-            }
-
-            /* (non-Javadoc)
-             * @see java.util.Iterator#remove()
-             */
-            public void remove()
-            {
-                iter.remove();
-                lastNext.setInverseRelationship(null);
-            }            
-        };
+        return collection.iterator();
     }
 
     /* (non-Javadoc)
@@ -96,12 +67,7 @@
      */
     public boolean remove(Object element)
     {
-        if (collection.remove(element))
-        {
-            ((DatabasePreferenceValue)element).setInverseRelationship(null);
-            return true;
-        }
-        return false;
+        return collection.remove(element);
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/jpa/PortletPreferencesProviderImpl.java Sun Mar  8 15:45:21 2009
@@ -280,6 +280,58 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider#removeAll(org.apache.jetspeed.om.portlet.PortletApplication)
+     */
+    @Transactional (readOnly=false)
+    public void removeAll(PortletApplication app)
+    {
+        // gather query parameters
+        String applicationName = app.getName();
+        // perform delete
+        EntityManager entityManager = getEntityManager();
+        Query portletPreferencesDelete = entityManager.createNamedQuery("DELETE_ALL_PORTLET_APPLICATION_PREFERENCES");
+        portletPreferencesDelete.setParameter("applicationName", applicationName);
+        List<DatabasePreference> deleteList = portletPreferencesDelete.getResultList();
+        if (!deleteList.isEmpty())
+        {
+            // remove queried preferences
+            for (DatabasePreference delete : deleteList)
+            {
+                entityManager.remove(delete);
+            }
+            // explicitly flush entity manager after remove
+            entityManager.flush();
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider#removeAll(org.apache.jetspeed.om.portlet.PortletDefinition)
+     */
+    @Transactional (readOnly=false)
+    public void removeAll(PortletDefinition pd)
+    {
+        // gather remove parameters
+        String applicationName = pd.getApplication().getName();
+        String portletName = pd.getPortletName();
+        // perform delete
+        EntityManager entityManager = getEntityManager();
+        Query portletPreferencesDelete = entityManager.createNamedQuery("DELETE_ALL_PORTLET_PREFERENCES");
+        portletPreferencesDelete.setParameter("applicationName", applicationName);
+        portletPreferencesDelete.setParameter("portletName", portletName);
+        List<DatabasePreference> deleteList = portletPreferencesDelete.getResultList();
+        if (!deleteList.isEmpty())
+        {
+            // remove queried preferences
+            for (DatabasePreference delete : deleteList)
+            {
+                entityManager.remove(delete);
+            }
+            // explicitly flush entity manager after remove
+            entityManager.flush();
+        }
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider#storeDefaults(org.apache.jetspeed.om.portlet.PortletApplication)
      */
     @Transactional (readOnly=false)
@@ -447,7 +499,7 @@
         {
             DatabasePreference preference = preferences.next();
             String name = preference.getName();
-            if (map.containsKey(name))
+            if (!map.containsKey(name))
             {
                 deletes.add(preference);
             }
@@ -459,8 +511,7 @@
         }
         for (InternalPortletPreference preference : map.values())
         {
-            DatabasePreference dbPref = mergeMap.get(preference.getName());
-            if (dbPref == null)
+            if (!mergeMap.containsKey(preference.getName()))
             {
                 inserts.add(preference);
             }                
@@ -499,22 +550,25 @@
         }
         for (DatabasePreference dbPref : updates)
         {
-            dbPref.getPreferenceValues().clear();
             InternalPortletPreference preference = map.get(dbPref.getName());
-            short index = 0;
-            for (String value : preference.getValues())
-            {
-                DatabasePreferenceValue dbValue = new DatabasePreferenceValue();
-                dbValue.setIndex(index++);
-                dbValue.setValue(value);
-                dbPref.getPreferenceValues().add(dbValue);
-            }            
-            // update, (potentially detached), database preference
-            if (!dbPref.isNew())
+            if (dbPref != preference)
             {
-                dbPref = entityManager.merge(dbPref);
+                dbPref.getPreferenceValues().clear();
+                short index = 0;
+                for (String value : preference.getValues())
+                {
+                    DatabasePreferenceValue dbValue = new DatabasePreferenceValue();
+                    dbValue.setIndex(index++);
+                    dbValue.setValue(value);
+                    dbPref.getPreferenceValues().add(dbValue);
+                }            
+                // update, (potentially detached), database preference                
+                if (!dbPref.isNew())
+                {
+                    dbPref = entityManager.merge(dbPref);
+                }
+                entityManager.persist(dbPref);
             }
-            entityManager.persist(dbPref);
         }
         // explicitly flush entity manager after remove/update
         entityManager.flush();

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ContainerRuntimeOptionValueImpl.java Sun Mar  8 15:45:21 2009
@@ -43,7 +43,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=ContainerRuntimeOptionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private ContainerRuntimeOptionImpl owner;
     @Basic
     @Column (name="RVALUE")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=CustomPortletModeImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private CustomPortletModeImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomPortletModeImpl.java Sun Mar  8 15:45:21 2009
@@ -58,7 +58,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="CUSTOM_NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=CustomWindowStateImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private CustomWindowStateImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/CustomWindowStateImpl.java Sun Mar  8 15:45:21 2009
@@ -58,7 +58,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="CUSTOM_NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventAliasImpl.java Sun Mar  8 15:45:21 2009
@@ -45,7 +45,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=EventDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private EventDefinitionImpl owner;
     
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=EventDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private EventDefinitionImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/EventDefinitionImpl.java Sun Mar  8 15:45:21 2009
@@ -65,7 +65,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="LOCAL_PART")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=InitParamImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="PARAMETER_ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="PARAMETER_ID", nullable=false)
     private InitParamImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/InitParamImpl.java Sun Mar  8 15:45:21 2009
@@ -62,7 +62,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl owner;
     @Basic
     @Column (name="OWNER_CLASS_NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/JetspeedServiceReferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/JetspeedServiceReferenceImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/JetspeedServiceReferenceImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/JetspeedServiceReferenceImpl.java Sun Mar  8 15:45:21 2009
@@ -51,7 +51,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/LanguageImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/LanguageImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/LanguageImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/LanguageImpl.java Sun Mar  8 15:45:21 2009
@@ -59,7 +59,7 @@
     // Members
 
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="PORTLET_ID", referencedColumnName="ID")
+    @JoinColumn (name="PORTLET_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl def;
     @Basic
     @Column (name="TITLE")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ParameterAliasImpl.java Sun Mar  8 15:45:21 2009
@@ -45,7 +45,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PublicRenderParameterImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PublicRenderParameterImpl owner;
     
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationContainerRuntimeOptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDisplayNameImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDisplayNameImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDisplayNameImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationDisplayNameImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationLocalizedFieldImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationLocalizedFieldImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationLocalizedFieldImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletApplicationLocalizedFieldImpl.java Sun Mar  8 15:45:21 2009
@@ -42,7 +42,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OBJECT_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="OBJECT_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl parent;
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionCollection.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionCollection.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionCollection.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionCollection.java Sun Mar  8 15:45:21 2009
@@ -58,36 +58,7 @@
      */
     public Iterator<T> iterator()
     {
-        return new Iterator<T>()
-        {
-            private Iterator<T> iter = collection.iterator();
-            private T lastNext = null;
-
-            /* (non-Javadoc)
-             * @see java.util.Iterator#hasNext()
-             */
-            public boolean hasNext()
-            {
-                return iter.hasNext();
-            }
-
-            /* (non-Javadoc)
-             * @see java.util.Iterator#next()
-             */
-            public T next()
-            {
-                return lastNext = iter.next();
-            }
-
-            /* (non-Javadoc)
-             * @see java.util.Iterator#remove()
-             */
-            public void remove()
-            {
-                iter.remove();
-                ((PortletDefinitionCollectionMember)lastNext).setInverseRelationship(null);
-            }            
-        };
+        return collection.iterator();
     }
 
     /* (non-Javadoc)
@@ -95,12 +66,7 @@
      */
     public boolean remove(Object element)
     {
-        if (collection.remove(element))
-        {
-            ((PortletDefinitionCollectionMember)element).setInverseRelationship(null);
-            return true;
-        }
-        return false;
+        return collection.remove(element);
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionContainerRuntimeOptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDisplayNameImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDisplayNameImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDisplayNameImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionDisplayNameImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionImpl.java Sun Mar  8 15:45:21 2009
@@ -87,7 +87,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false, cascade=CascadeType.PERSIST)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplication app;    
     @Basic
     @Column (name="NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionList.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionList.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionList.java Sun Mar  8 15:45:21 2009
@@ -65,12 +65,7 @@
      */
     public T remove(int index)
     {
-        T element = list.remove(index);
-        if (element != null)
-        {
-            ((PortletDefinitionCollectionMember)element).setInverseRelationship(null);
-        }
-        return element;
+        return list.remove(index);
     }
 
     /* (non-Javadoc)
@@ -79,12 +74,7 @@
     public T set(int index, T element)
     {
         ((PortletDefinitionCollectionMember)element).setInverseRelationship(owningObject);
-        T removedElement = list.set(index, element);
-        if (removedElement != null)
-        {
-            ((PortletDefinitionCollectionMember)removedElement).setInverseRelationship(null);
-        }
-        return removedElement;
+        return list.set(index, element);
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionLocalizedFieldImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionLocalizedFieldImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionLocalizedFieldImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PortletDefinitionLocalizedFieldImpl.java Sun Mar  8 15:45:21 2009
@@ -42,7 +42,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OBJECT_ID", referencedColumnName="ID")
+    @JoinColumn (name="OBJECT_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl parent;
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/ProcessingEventReferenceImpl.java Sun Mar  8 15:45:21 2009
@@ -47,7 +47,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl owner;
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=PublicRenderParameterImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PublicRenderParameterImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublicRenderParameterImpl.java Sun Mar  8 15:45:21 2009
@@ -65,7 +65,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="LOCAL_PART")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublishingEventReferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublishingEventReferenceImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublishingEventReferenceImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/PublishingEventReferenceImpl.java Sun Mar  8 15:45:21 2009
@@ -47,7 +47,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl owner;
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=SecurityRoleImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private SecurityRoleImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleImpl.java Sun Mar  8 15:45:21 2009
@@ -61,7 +61,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=SecurityRoleRefImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private SecurityRoleRefImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SecurityRoleRefImpl.java Sun Mar  8 15:45:21 2009
@@ -66,7 +66,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="PORTLET_DEFINITION_ID", referencedColumnName="ID")
+    @JoinColumn (name="PORTLET_DEFINITION_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl def;
     @Basic
     @Column (name="ROLE_LINK")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportedPublicRenderParameterImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportedPublicRenderParameterImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportedPublicRenderParameterImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportedPublicRenderParameterImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl owner;
     @Basic
     @Column (name="NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportsImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportsImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportsImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/SupportsImpl.java Sun Mar  8 15:45:21 2009
@@ -59,7 +59,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="PORTLET_ID", referencedColumnName="ID")
+    @JoinColumn (name="PORTLET_ID", referencedColumnName="ID", nullable=false)
     private PortletDefinitionImpl def;
     @Basic
     @Column (name="MIME_TYPE")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=UserAttributeImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private UserAttributeImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeImpl.java Sun Mar  8 15:45:21 2009
@@ -61,7 +61,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="NAME")

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefDescriptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefDescriptionImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefDescriptionImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefDescriptionImpl.java Sun Mar  8 15:45:21 2009
@@ -44,7 +44,7 @@
     // new class defined only to facilitate JPA table/class mapping
 
     @ManyToOne (targetEntity=UserAttributeRefImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="OWNER_ID", referencedColumnName="ID")
+    @JoinColumn (name="OWNER_ID", referencedColumnName="ID", nullable=false)
     private UserAttributeRefImpl owner;
 
     /**

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefImpl.java?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/jpa/UserAttributeRefImpl.java Sun Mar  8 15:45:21 2009
@@ -63,7 +63,7 @@
     @Column (name="JPA_VERSION")
     private int jpaVersion;
     @ManyToOne (targetEntity=PortletApplicationDefinitionImpl.class, fetch=FetchType.LAZY, optional=false)
-    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID")
+    @JoinColumn (name="APPLICATION_ID", referencedColumnName="APPLICATION_ID", nullable=false)
     private PortletApplicationDefinitionImpl app;
     @Basic
     @Column (name="NAME")

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestOpenJPAPortletPreferencesPerformance.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestOpenJPAPortletPreferencesPerformance.java?rev=751448&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestOpenJPAPortletPreferencesPerformance.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestOpenJPAPortletPreferencesPerformance.java Sun Mar  8 15:45:21 2009
@@ -0,0 +1,87 @@
+/*
+ * 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.jetspeed.components.portletpreferences;
+
+import junit.framework.Test;
+
+import org.apache.jetspeed.components.portletregistry.jpa.RegistryManagerContext;
+
+/**
+ * TestOpenJPAPortletPreferencesPerformance
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ *          
+ */
+public class TestOpenJPAPortletPreferencesPerformance extends TestPortletPreferencesPerformance
+{
+    private RegistryManagerContext context;
+
+    /**
+     * Create test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
+    {
+        return createFixturedTestSuite(TestOpenJPAPortletPreferencesPerformance.class, new String[]{"setupTest", "testReadMissPerformance", "testWritePerformance", "testReadPerformance", "testRemovePerformance", "teardownTest"});
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase#getBeanDefinitionFilterCategories()
+     */
+    protected String getBeanDefinitionFilterCategories()
+    {
+        return "default,jpa,jndiDS";
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.portletpreferences.TestPortletPreferencesProvider#getConfigurations()
+     */
+    protected String[] getConfigurations()
+    {
+        return new String[]{"openjpa-registry.xml"};
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase#startConversationalTxn()
+     */
+    protected void startConversationalTxn()
+    {
+        // create scoped context bean for thread transaction
+        context = (RegistryManagerContext)scm.createPrototypeComponent("registryManagerContext");
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase#endConversationalTxn()
+     */
+    protected void endConversationalTxn()
+    {
+        // destroy scoped context bean for thread transaction
+        scm.destroyPrototypeComponent("registryManagerContext", context);
+    }
+
+    /**
+     * Test main entry point.
+     * 
+     * @param args process args
+     */
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]{TestOpenJPAPortletPreferencesPerformance.class.getName()});
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestPortletPreferencesPerformance.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestPortletPreferencesPerformance.java?rev=751448&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestPortletPreferencesPerformance.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletpreferences/TestPortletPreferencesPerformance.java Sun Mar  8 15:45:21 2009
@@ -0,0 +1,298 @@
+/*
+ * 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.jetspeed.components.portletpreferences;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase;
+import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.container.PortletEntity;
+import org.apache.jetspeed.om.page.Fragment;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.Preferences;
+import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.internal.InternalPortletPreference;
+import org.apache.pluto.internal.impl.PortletPreferenceImpl;
+
+import junit.framework.Test;
+import org.jmock.Mock;
+import org.jmock.core.matcher.InvokeAtLeastOnceMatcher;
+import org.jmock.core.stub.ReturnStub;
+
+public class TestPortletPreferencesPerformance extends JPADatasourceEnabledSpringTestCase
+{
+    private static final Log log = LogFactory.getLog(TestPortletPreferencesPerformance.class);
+
+    private static final int N = 2;
+    private static final PortletMode VIEW_PORTLET_MODE = new PortletMode("view");
+
+    private PortletApplication portletApplication;
+    private PortletDefinition portletDefinition;
+    private PortletWindow portletWindow;
+    private PortletRequest [] portletRequest;
+    
+    /**
+     * Get ordered test suite.
+     * 
+     * @return test suite to execute.
+     */
+    public static Test suite()
+    {
+        return createFixturedTestSuite(TestPortletPreferencesPerformance.class, new String[]{"setupTest", "testReadMissPerformance", "testWritePerformance", "testReadPerformance", "testRemovePerformance", "teardownTest"});
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.test.AbstractSpringTestCase#getConfigurations()
+     */
+    protected String[] getConfigurations()
+    {
+        return new String[]{"transaction.xml", "registry-test.xml", "cache-test.xml"};
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.components.util.jpa.JPADatasourceEnabledSpringTestCase#setUp()
+     */
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        
+        // test components
+        PortletRegistry registry = (PortletRegistry) scm.getComponent("portletRegistry");
+        PortletEntityAccessComponent entityAccess = (PortletEntityAccessComponent) scm.getComponent("portletEntityAccess");
+
+        // setup test parameters
+        portletApplication = registry.newPortletApplication();
+        portletApplication.setName("PA");
+        portletDefinition = portletApplication.addPortlet("PD");
+        Preferences pdPreferences = portletDefinition.getDescriptorPreferences();
+        pdPreferences.addPreference("p0").addValue("p0-value");
+        pdPreferences.addPreference("p1").addValue("p1-value");
+        pdPreferences.addPreference("p2").addValue("p2-value");
+        pdPreferences.addPreference("p3").addValue("p3-value");
+        pdPreferences.addPreference("p4").addValue("p4-value");
+        String entityId = portletApplication.getName()+PortletRegistry.PORTLET_UNIQUE_NAME_SEPARATOR+portletDefinition.getPortletName()+PortletRegistry.PORTLET_UNIQUE_NAME_SEPARATOR+"0:0:0";
+        PortletEntity portletEntity = entityAccess.newPortletEntityInstance(portletDefinition, entityId);
+        Mock mockFragment = new Mock(Fragment.class);
+        mockFragment.expects(new InvokeAtLeastOnceMatcher()).method("getPreferences").will(new ReturnStub(new ArrayList()));
+        portletEntity.setFragment((Fragment)mockFragment.proxy());
+        PortletWindowImpl portletWindowImpl = new PortletWindowImpl();
+        portletWindowImpl.setPortletEntity(portletEntity);
+        portletWindow = portletWindowImpl;
+        portletRequest = new PortletRequest[N];
+        for (int i = 0; (i < N); i++)
+        {
+            final String requestUser = "user"+i;
+            Mock mockPortletRequest = new Mock(PortletRequest.class);
+            mockPortletRequest.expects(new InvokeAtLeastOnceMatcher()).method("getPortletMode").will(new ReturnStub(VIEW_PORTLET_MODE));
+            mockPortletRequest.expects(new InvokeAtLeastOnceMatcher()).method("getUserPrincipal").will(new ReturnStub(new Principal(){public String getName(){return requestUser;}}));
+            portletRequest[i] = (PortletRequest)mockPortletRequest.proxy();
+        }
+    }
+    
+    /**
+     * Setup portlet preferences state for performance test.
+     * 
+     * @throws Exception
+     */
+    public void setupTest() throws Exception
+    {
+        // test components
+        PortletPreferencesProvider preferences = (PortletPreferencesProvider) scm.getComponent("portletPreferencesProvider");
+
+        // clear preferences
+        preferences.preloadAllEntities();
+        preferences.preloadApplicationPreferences(portletApplication.getName());
+        if (!preferences.getDefaultPreferences(portletDefinition).isEmpty())
+        {
+            preferences.removeAll(portletApplication);
+        }
+
+        // application preferences
+        preferences.storeDefaults(portletApplication);
+    }
+
+    /**
+     * Execute read performance test for portlet preferences.
+     * 
+     * @throws Exception
+     */
+    public void testReadMissPerformance() throws Exception
+    {
+        // test components
+        PortletPreferencesProvider preferences = (PortletPreferencesProvider) scm.getComponent("portletPreferencesProvider");
+
+        // read default and missing user preferences
+        preferences.getDefaultPreferences(portletWindow, portletRequest[0]);
+        preferences.getStoredPreferences(portletWindow, portletRequest[0]);
+        String msg = getClass().getSimpleName()+"."+getName()+" reading default and missing user preferences...";
+        log.info(msg);
+        System.out.println(msg);
+        long startMissing = System.currentTimeMillis();
+        for (int i = 1; (i < N); i++)
+        {
+            preferences.getDefaultPreferences(portletWindow, portletRequest[i]);
+            preferences.getStoredPreferences(portletWindow, portletRequest[i]);
+        }
+        long endMissing = System.currentTimeMillis();
+        msg = getClass().getSimpleName()+"."+getName()+" read default and missing user preferences time: "+(endMissing-startMissing);
+        log.info(msg);
+        System.out.println(msg);
+    }
+
+    /**
+     * Execute write performance test for portlet preferences.
+     * 
+     * @throws Exception
+     */
+    public void testWritePerformance() throws Exception
+    {
+        // test components
+        PortletPreferencesProvider preferences = (PortletPreferencesProvider) scm.getComponent("portletPreferencesProvider");
+
+        // write user preferences
+        Map<String,InternalPortletPreference> userPreferences = new HashMap<String,InternalPortletPreference>();
+        userPreferences.put("p0-0", new PortletPreferenceImpl("p0-0", new String[]{"p0-value-0"}));
+        userPreferences.put("p1-0", new PortletPreferenceImpl("p1-0", new String[]{"p1-value-0"}));
+        userPreferences.put("p2-0", new PortletPreferenceImpl("p2-0", new String[]{"p2-value-0"}));
+        preferences.store(portletWindow, portletRequest[0], userPreferences);
+        String msg = getClass().getSimpleName()+"."+getName()+" writing user preferences...";
+        log.info(msg);
+        System.out.println(msg);
+        long startWrite = System.currentTimeMillis();
+        for (int i = 1; (i < N); i++)
+        {
+            userPreferences = new HashMap<String,InternalPortletPreference>();
+            userPreferences.put("p0-"+i, new PortletPreferenceImpl("p0-"+i, new String[]{"p0-value-"+i}));
+            userPreferences.put("p1-"+i, new PortletPreferenceImpl("p1-"+i, new String[]{"p1-value-"+i}));
+            userPreferences.put("p2-"+i, new PortletPreferenceImpl("p2-"+i, new String[]{"p2-value-"+i}));
+            preferences.store(portletWindow, portletRequest[i], userPreferences);
+        }
+        long endWrite = System.currentTimeMillis();
+        msg = getClass().getSimpleName()+"."+getName()+" write user preferences time: "+(endWrite-startWrite);
+        log.info(msg);
+        System.out.println(msg);
+
+        // modify user preferences
+        userPreferences = preferences.getStoredPreferences(portletWindow, portletRequest[0]);
+        assertEquals(3, userPreferences.size());
+        userPreferences.remove("p0-0");
+        userPreferences.put("p2-0", new PortletPreferenceImpl("p2-0", new String[]{"p2-value-0-modified"}));
+        userPreferences.put("p3-0", new PortletPreferenceImpl("p3-0", new String[]{"p3-value-0-modified"}));
+        userPreferences.put("p4-0", new PortletPreferenceImpl("p4-0", new String[]{"p4-value-0-modified"}));
+        userPreferences.put("p5-0", new PortletPreferenceImpl("p5-0", new String[]{"p5-value-0-modified"}));
+        preferences.store(portletWindow, portletRequest[0], userPreferences);
+        msg = getClass().getSimpleName()+"."+getName()+" modifying user preferences...";
+        log.info(msg);
+        System.out.println(msg);
+        long startModify = System.currentTimeMillis();
+        for (int i = 1; (i < N); i++)
+        {
+            userPreferences = preferences.getStoredPreferences(portletWindow, portletRequest[i]);
+            assertEquals(3, userPreferences.size());
+            userPreferences.remove("p0-"+i);
+            userPreferences.put("p2-"+i, new PortletPreferenceImpl("p2-"+i, new String[]{"p2-value-"+i+"-modified"}));
+            userPreferences.put("p3-"+i, new PortletPreferenceImpl("p3-"+i, new String[]{"p3-value-"+i+"-modified"}));
+            userPreferences.put("p4-"+i, new PortletPreferenceImpl("p4-"+i, new String[]{"p4-value-"+i+"-modified"}));
+            userPreferences.put("p5-"+i, new PortletPreferenceImpl("p5-"+i, new String[]{"p5-value-"+i+"-modified"}));
+            preferences.store(portletWindow, portletRequest[i], userPreferences);
+        }
+        long endModify = System.currentTimeMillis();
+        msg = getClass().getSimpleName()+"."+getName()+" modify user preferences time: "+(endModify-startModify);
+        log.info(msg);
+        System.out.println(msg);
+    }
+
+    /**
+     * Execute read performance test for portlet preferences.
+     * 
+     * @throws Exception
+     */
+    public void testReadPerformance() throws Exception
+    {
+        // test components
+        PortletPreferencesProvider preferences = (PortletPreferencesProvider) scm.getComponent("portletPreferencesProvider");
+        
+        // read default and user preferences
+        Map<String,InternalPortletPreference> defaultPreferences = preferences.getDefaultPreferences(portletWindow, portletRequest[0]);
+        assertEquals(5, defaultPreferences.size());
+        Map<String,InternalPortletPreference> userPreferences = preferences.getStoredPreferences(portletWindow, portletRequest[0]);
+        assertEquals(5, userPreferences.size());
+        String msg = getClass().getSimpleName()+"."+getName()+" reading default and user preferences...";
+        log.info(msg);
+        System.out.println(msg);
+        long startRead = System.currentTimeMillis();
+        for (int i = 1; (i < N); i++)
+        {
+            defaultPreferences = preferences.getDefaultPreferences(portletWindow, portletRequest[i]);
+            assertEquals(5, defaultPreferences.size());
+            userPreferences = preferences.getStoredPreferences(portletWindow, portletRequest[i]);
+            assertEquals(5, userPreferences.size());
+        }
+        long endRead = System.currentTimeMillis();
+        msg = getClass().getSimpleName()+"."+getName()+" read default and user preferences time: "+(endRead-startRead);
+        log.info(msg);
+        System.out.println(msg);
+    }
+
+    /**
+     * Execute remove performance test for portlet preferences.
+     * 
+     * @throws Exception
+     */
+    public void testRemovePerformance() throws Exception
+    {
+        // test components
+        PortletPreferencesProvider preferences = (PortletPreferencesProvider) scm.getComponent("portletPreferencesProvider");
+            
+        // remove default and user preferences
+        preferences.removeDefaults(portletDefinition);
+        String msg = getClass().getSimpleName()+"."+getName()+" removing all preferences...";
+        log.info(msg);
+        System.out.println(msg);
+        long startRemove = System.currentTimeMillis();
+        preferences.removeAll(portletDefinition);
+        long endRemove = System.currentTimeMillis();
+        msg = getClass().getSimpleName()+"."+getName()+" remove all preferences time: "+(endRemove-startRemove);
+        log.info(msg);
+        System.out.println(msg);
+    }
+    
+    /**
+     * Teardown portlet preferences state after performance test.
+     * 
+     * @throws Exception
+     */
+    public void teardownTest() throws Exception
+    {
+        // test components
+        PortletPreferencesProvider preferences = (PortletPreferencesProvider) scm.getComponent("portletPreferencesProvider");
+
+        // clear all preferences
+        preferences.removeAll(portletApplication);
+    }    
+}

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/jpa-registry.xml Sun Mar  8 15:45:21 2009
@@ -65,6 +65,7 @@
     </bean>
     <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close" depends-on="atomikosUserTransactionService">
         <property name="forceShutdown" value="true"/>
+        <property name="transactionTimeout" value="60"/>
     </bean>
     <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
         <property name="transactionManager" ref="atomikosTransactionManager"/>

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/log4j.properties Sun Mar  8 15:45:21 2009
@@ -23,48 +23,64 @@
 
 log4j.rootCategory = ERROR, errorlogging
 
-#log4j.category.openjpa.Tool = INFO, infologging
-#log4j.category.openjpa.Runtime = INFO, infologging
-#log4j.category.openjpa.Remote = WARN, infologging
-#log4j.category.openjpa.DataCache = WARN, infologging
-#log4j.category.openjpa.MetaData = WARN, infologging
-#log4j.category.openjpa.Enhance = WARN, infologging
-#log4j.category.openjpa.Query = WARN, infologging
-#log4j.category.openjpa.jdbc.SQL = WARN, infologging
-#log4j.category.openjpa.jdbc.JDBC = WARN, infologging
-#log4j.category.openjpa.jdbc.Schema = WARN, infologging
-
-log4j.category.org.springframework = DEBUG, infologging
+log4j.category.org.springframework = ERROR, infologging
 log4j.additivity.org.springframework = false
 
-log4j.category.openjpa.Tool = TRACE, infologging
+log4j.category.openjpa.Tool = INFO, infologging
 log4j.additivity.openjpa.Tool = false
-log4j.category.openjpa.Runtime = TRACE, infologging
+log4j.category.openjpa.Runtime = INFO, infologging
 log4j.additivity.openjpa.Runtime = false
-log4j.category.openjpa.Remote = TRACE, infologging
+log4j.category.openjpa.Remote = WARN, infologging
 log4j.additivity.openjpa.Remote = false
-log4j.category.openjpa.DataCache = TRACE, infologging
+log4j.category.openjpa.DataCache = WARN, infologging
 log4j.additivity.openjpa.DataCache = false
-log4j.category.openjpa.MetaData = TRACE, infologging
+log4j.category.openjpa.MetaData = WARN, infologging
 log4j.additivity.openjpa.MetaData = false
-log4j.category.openjpa.Enhance = TRACE, infologging
+log4j.category.openjpa.Enhance = WARN, infologging
 log4j.additivity.openjpa.Enhance = false
-log4j.category.openjpa.Query = TRACE, infologging
+log4j.category.openjpa.Query = WARN, infologging
 log4j.additivity.openjpa.Query = false
-log4j.category.openjpa.jdbc.SQL = TRACE, infologging
+log4j.category.openjpa.jdbc.SQL = WARN, infologging
 log4j.additivity.openjpa.jdbc.SQL = false
-#log4j.category.openjpa.jdbc.JDBC = TRACE, infologging
-log4j.category.openjpa.jdbc.JDBC = DEBUG, infologging
+log4j.category.openjpa.jdbc.JDBC = WARN, infologging
 log4j.additivity.openjpa.jdbc.JDBC = false
-log4j.category.openjpa.jdbc.Schema = TRACE, infologging
+log4j.category.openjpa.jdbc.Schema = WARN, infologging
 log4j.additivity.openjpa.jdbc.Schema = false
 
+log4j.category.atomikos = WARN, infologging
+log4j.additivity.atomikos = false
+
+#log4j.category.org.springframework = DEBUG, infologging
+#log4j.additivity.org.springframework = false
+
+#log4j.category.openjpa.Tool = TRACE, infologging
+#log4j.additivity.openjpa.Tool = false
+#log4j.category.openjpa.Runtime = TRACE, infologging
+#log4j.additivity.openjpa.Runtime = false
+#log4j.category.openjpa.Remote = TRACE, infologging
+#log4j.additivity.openjpa.Remote = false
+#log4j.category.openjpa.DataCache = TRACE, infologging
+#log4j.additivity.openjpa.DataCache = false
+#log4j.category.openjpa.MetaData = TRACE, infologging
+#log4j.additivity.openjpa.MetaData = false
+#log4j.category.openjpa.Enhance = TRACE, infologging
+#log4j.additivity.openjpa.Enhance = false
+#log4j.category.openjpa.Query = TRACE, infologging
+#log4j.additivity.openjpa.Query = false
+#log4j.category.openjpa.jdbc.SQL = TRACE, infologging
+#log4j.additivity.openjpa.jdbc.SQL = false
+##log4j.category.openjpa.jdbc.JDBC = TRACE, infologging
+#log4j.category.openjpa.jdbc.JDBC = DEBUG, infologging
+#log4j.additivity.openjpa.jdbc.JDBC = false
+#log4j.category.openjpa.jdbc.Schema = TRACE, infologging
+#log4j.additivity.openjpa.jdbc.Schema = false
+
+#log4j.category.atomikos = DEBUG, infologging
+#log4j.additivity.atomikos = false
+
 log4j.category.org.apache.jetspeed = DEBUG, infologging
 log4j.additivity.org.apache.jetspeed = false
 
-log4j.category.atomikos = DEBUG, infologging
-log4j.additivity.atomikos = false
-
 log4j.appender.errorlogging = org.apache.log4j.FileAppender
 log4j.appender.errorlogging.file = ${basedir}/target/surefire-reports/tests-error.log
 log4j.appender.errorlogging.layout = org.apache.log4j.PatternLayout

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/registry-test.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/registry-test.xml?rev=751448&r1=751447&r2=751448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/registry-test.xml (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-registry/src/test/resources/registry-test.xml Sun Mar  8 15:45:21 2009
@@ -90,8 +90,8 @@
     </property>
     <property name="transactionAttributes">
       <props>
-        <prop key="save*">PROPAGATION_REQUIRED</prop>
-        <prop key="delete*">PROPAGATION_REQUIRED</prop>
+        <prop key="store*">PROPAGATION_REQUIRED</prop>
+        <prop key="remove*">PROPAGATION_REQUIRED</prop>
         <prop key="*">PROPAGATION_SUPPORTS</prop>
       </props>
     </property>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message