openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r721073 - in /openjpa/trunk: openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/
Date Thu, 27 Nov 2008 02:41:13 GMT
Author: jrbauer
Date: Wed Nov 26 18:41:13 2008
New Revision: 721073

URL: http://svn.apache.org/viewvc?rev=721073&view=rev
Log:
OPENJPA-773 Updates for JPA 2.0 spec API.  Stubbed out unimplemented methods.

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAQuery.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java?rev=721073&r1=721072&r2=721073&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/annotations/NonstandardMappingEntity.java
Wed Nov 26 18:41:13 2008
@@ -28,6 +28,7 @@
 import org.apache.openjpa.jdbc.meta.strats.*;
 import org.apache.openjpa.persistence.*;
 import org.apache.openjpa.persistence.jdbc.*;
+import org.apache.openjpa.persistence.jdbc.OrderColumn;
 
 
 @Entity

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java?rev=721073&r1=721072&r2=721073&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
Wed Nov 26 18:41:13 2008
@@ -28,7 +28,10 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
+
+import javax.persistence.Cache;
 import javax.persistence.EntityManagerFactory;
+import javax.persistence.QueryBuilder;
 
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.enhance.Reflection;
@@ -332,4 +335,19 @@
             throw PersistenceExceptions.toPersistenceException(e);
         }
 	}
+
+    public Cache getCache() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public QueryBuilder getQueryBuilder() {
+        throw new UnsupportedOperationException(
+           "JPA 2.0 - Method not yet implemented");
+    }
+
+    public Set<String> getSupportedProperties() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=721073&r1=721072&r2=721073&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Wed Nov 26 18:41:13 2008
@@ -34,10 +34,14 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.util.IdentityHashMap;
+import java.util.Set;
+
 import javax.persistence.EntityManager;
 import javax.persistence.FlushModeType;
 import javax.persistence.LockModeType;
 import javax.persistence.Query;
+import javax.persistence.QueryBuilder;
+import javax.persistence.QueryDefinition;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
@@ -1380,4 +1384,59 @@
             }
         }
     }
+
+    public void clear(Object entity) {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public Query createQuery(QueryDefinition qdef) {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode)
{
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode,
Map<String, Object> properties) {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public Map<String, Object> getProperties() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public QueryBuilder getQueryBuilder() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public Set<String> getSupportedProperties() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public void lock(Object entity, LockModeType lockMode, Map<String, Object> properties)
{
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public void refresh(Object entity, LockModeType lockMode) {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties)
{
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public <T> T unwrap(Class<T> cls) {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAQuery.java?rev=721073&r1=721072&r2=721073&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAQuery.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAQuery.java
Wed Nov 26 18:41:13 2008
@@ -21,6 +21,7 @@
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import javax.persistence.FlushModeType;
 import javax.persistence.Query;
@@ -133,16 +134,18 @@
     public boolean hasPositionalParameters();
 
     /**
-     * The positional parameters for the query; empty array if none or
+     * The positional parameters for the query; empty list if none or
      * if query uses named parameters.
+     * Note: This method signature was changed in 2.0 to return a List
+     * instead of Object[] to match the JPA 2.0 spec.
      */
-    public Object[] getPositionalParameters();
+    public List getPositionalParameters();
 
     /**
      * The named parameters for the query; empty map if none or
      * if query uses positional parameters.
      */
-    public Map getNamedParameters();
+    public Map<String, Object> getNamedParameters();
 
     /**
      * Set parameters.

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?rev=721073&r1=721072&r2=721073&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Wed Nov 26 18:41:13 2008
@@ -36,6 +36,7 @@
 import java.util.TreeMap;
 
 import javax.persistence.FlushModeType;
+import javax.persistence.LockModeType;
 import javax.persistence.Query;
 import javax.persistence.TemporalType;
 
@@ -62,7 +63,7 @@
  */
 public class QueryImpl implements OpenJPAQuerySPI, Serializable {
 
-	private static final Object[] EMPTY_ARRAY = new Object[0];
+    private static final List EMPTY_LIST = new ArrayList(0);
 
 	private static final Localizer _loc = Localizer.forPackage(QueryImpl.class);
 
@@ -673,21 +674,21 @@
 		return _positional != null;
 	}
 
-	/**
-	 * Gets the array of positional parameter values. A value of
-	 * <code>GAP_FILLER</code> indicates that user has not set the
-	 * corresponding positional parameter. A value of null implies that user has
-	 * set the value as null.
-	 */
-	public Object[] getPositionalParameters() {
-		_query.lock();
-		try {
-			return (_positional == null) ? EMPTY_ARRAY : _positional.values()
-					.toArray();
-		} finally {
-			_query.unlock();
-		}
-	}
+    /**
+     * Gets the list of positional parameter values. A value of
+     * <code>GAP_FILLER</code> indicates that user has not set the
+     * corresponding positional parameter. A value of null implies that user has
+     * set the value as null.
+     */
+    public List getPositionalParameters() {
+        _query.lock();
+        try {
+            return (_positional == null) ? EMPTY_LIST : 
+                    new ArrayList<Object>(_positional.values());
+        } finally {
+            _query.unlock();
+        }
+    }
 
 	public OpenJPAQuery setParameters(Object... params) {
 		_query.assertOpen();
@@ -705,7 +706,7 @@
 		}
 	}
 
-	public Map getNamedParameters() {
+	public Map<String, Object> getNamedParameters() {
 		_query.lock();
 		try {
 			return (_named == null) ? Collections.EMPTY_MAP : Collections
@@ -751,4 +752,29 @@
 			return false;
 		return _query.equals(((QueryImpl) other)._query);
 	}
+
+    public Map<String, Object> getHints() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public LockModeType getLockMode() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public Set<String> getSupportedHints() {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public Query setLockMode(LockModeType lockMode) {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
+
+    public <T> T unwrap(Class<T> cls) {
+        throw new UnsupportedOperationException(
+            "JPA 2.0 - Method not yet implemented");
+    }
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java?rev=721073&r1=721072&r2=721073&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java
Wed Nov 26 18:41:13 2008
@@ -84,7 +84,7 @@
         QueryImpl impl = (QueryImpl) q;
         if (impl.hasPositionalParameters())
             return QueryKey.newInstance(impl.getDelegate(),
-                impl.getPositionalParameters());
+                impl.getPositionalParameters().toArray());
         return QueryKey.newInstance(impl.getDelegate(),
             impl.getNamedParameters());
     }



Mime
View raw message