openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r652987 - in /openjpa/branches/1.1.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-kernel/src/main/ja...
Date Sat, 03 May 2008 03:13:46 GMT
Author: pcl
Date: Fri May  2 20:13:45 2008
New Revision: 652987

URL: http://svn.apache.org/viewvc?rev=652987&view=rev
Log:
OPENJPA-579, OPENJPA-585, OPENJPA-587, OPENJPA-588. Checking in on behalf of Sandeep Srivastava
and Jason Zheng.

Modified:
    openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/MaxEmbeddedLobFieldStrategy.java
    openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
    openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
    openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java
    openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java

Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/MaxEmbeddedLobFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/MaxEmbeddedLobFieldStrategy.java?rev=652987&r1=652986&r2=652987&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/MaxEmbeddedLobFieldStrategy.java
(original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/MaxEmbeddedLobFieldStrategy.java
Fri May  2 20:13:45 2008
@@ -187,7 +187,8 @@
 
     public int select(Select sel, OpenJPAStateManager sm, JDBCStore store,
         JDBCFetchConfiguration fetch, int eagerMode) {
-        if (sel.isDistinct())
+        if (sel.isDistinct() || 
+            eagerMode == JDBCFetchConfiguration.EAGER_NONE)
             return -1;
         sel.select(field.getColumns()[0], field.join(sel));
         return 1;

Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java?rev=652987&r1=652986&r2=652987&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
(original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
Fri May  2 20:13:45 2008
@@ -82,6 +82,7 @@
 
         supportsLockingWithDistinctClause = false;
         supportsNullTableForGetColumns = false;
+        requiresAliasForSubselect = true;
         requiresAutoCommitForMetaData = true;
 
         maxTableNameLength = 30;

Modified: openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java?rev=652987&r1=652986&r2=652987&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
(original)
+++ openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
Fri May  2 20:13:45 2008
@@ -86,7 +86,8 @@
         PersistenceCapable newInstance;
         if (!manager.getCopyNew())
             newInstance = pc;
-        else if (appId == null) // datastore identity
+        else if (appId == null)
+            // datastore identity or application identity with generated keys
             newInstance = pc.pcNewInstance(null, false);
         else // application identity: use existing fields
             newInstance = pc.pcNewInstance(null, appId, false);

Modified: openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java?rev=652987&r1=652986&r2=652987&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java
(original)
+++ openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java
Fri May  2 20:13:45 2008
@@ -29,6 +29,7 @@
 import org.apache.openjpa.meta.FieldMetaData;
 import org.apache.openjpa.meta.JavaTypes;
 import org.apache.openjpa.meta.ValueMetaData;
+import org.apache.openjpa.meta.ValueStrategies;
 import org.apache.openjpa.util.ApplicationIds;
 import org.apache.openjpa.util.ObjectNotFoundException;
 import org.apache.openjpa.util.OptimisticException;
@@ -92,8 +93,11 @@
             sm = (StateManagerImpl) broker.embed(into, null, owner, ownerMeta);
             into = sm.getPersistenceCapable();
         } else if (isNew) {
-            sm = persist(manager, pc, meta, ApplicationIds.create(pc, meta),
-                explicit);
+            Object oid = null;
+            if (!isPrimaryKeysGenerated(meta))
+                oid = ApplicationIds.create(pc, meta);
+
+            sm = persist(manager, pc, meta, oid, explicit);
             into = sm.getPersistenceCapable();
         } else if (!embedded && into == null) {
             Object id = getDetachedObjectId(manager, toAttach);
@@ -373,4 +377,13 @@
             return null;
         }
     }
+
+    private boolean isPrimaryKeysGenerated(ClassMetaData meta) {
+        FieldMetaData[] pks = meta.getPrimaryKeyFields();
+        for (int i = 0; i < pks.length; i++) {
+            if (pks[i].getValueStrategy() != ValueStrategies.NONE)
+                return true;
+        }
+        return false;
+    }
 }

Modified: openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java?rev=652987&r1=652986&r2=652987&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
(original)
+++ openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
Fri May  2 20:13:45 2008
@@ -966,8 +966,7 @@
                 fmd = (FieldMetaData) itr.next();
                 if (fmd.getManagement() != FieldMetaData.MANAGE_NONE) {
                     fmd.setDeclaredIndex(fields.size());
-                    if (fmd.getIndex() == -1)
-                        fmd.setIndex(fmd.getDeclaredIndex());
+                    fmd.setIndex(fmd.getDeclaredIndex());
                     fields.add(fmd);
                 }
             }



Mime
View raw message