geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r797609 - in /geronimo/specs/trunk/geronimo-jpa_2.0_spec: ./ src/main/java/javax/persistence/ src/main/java/javax/persistence/criteria/ src/main/java/javax/persistence/spi/
Date Fri, 24 Jul 2009 19:08:09 GMT
Author: dwoods
Date: Fri Jul 24 19:08:09 2009
New Revision: 797609

URL: http://svn.apache.org/viewvc?rev=797609&view=rev
Log:
GERONIMO-4410 API updates from 20090723.  Patch contributed by Jeremy Bauer.

Modified:
    geronimo/specs/trunk/geronimo-jpa_2.0_spec/pom.xml
    geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Parameter.java
    geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java
    geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java
    geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/TypedQuery.java
    geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/criteria/Order.java
    geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/spi/PersistenceUnitInfo.java

Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/pom.xml?rev=797609&r1=797608&r2=797609&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/pom.xml Fri Jul 24 19:08:09 2009
@@ -34,7 +34,7 @@
     <artifactId>geronimo-jpa_2.0_spec</artifactId>
     <packaging>bundle</packaging>
     <name>Apache Geronimo JSR-317 JPA 2.0 EARLY ACCESS Spec API</name>
-    <version>1.0-EA5-SNAPSHOT</version>
+    <version>1.0-EA6-SNAPSHOT</version>
 
     <description>Implementation of Sun JSR-317 JPA 2.0 EARLY ACCESS Spec API</description>
 

Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Parameter.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Parameter.java?rev=797609&r1=797608&r2=797609&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Parameter.java
(original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Parameter.java
Fri Jul 24 19:08:09 2009
@@ -31,5 +31,7 @@
     String getName();
 
     Integer getPosition();
+
+     Class<T> getJavaType();
 }
 

Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java?rev=797609&r1=797608&r2=797609&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java
(original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Persistence.java
Fri Jul 24 19:08:09 2009
@@ -30,9 +30,11 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.persistence.spi.LoadState;
 import javax.persistence.spi.PersistenceProvider;
 import javax.persistence.spi.PersistenceProviderResolver;
 import javax.persistence.spi.PersistenceProviderResolverHolder;
+import javax.persistence.spi.ProviderUtil;
 
 /**
  * @version $Rev$ $Date$
@@ -161,13 +163,78 @@
      */
     private static class PersistenceUtilImpl implements PersistenceUtil {
 
+        /*
+         * Determines the load state of the attribute of an entity 
+         * @see javax.persistence.PersistenceUtil#isLoaded(java.lang.Object, java.lang.String)
+         */
             public boolean isLoaded(Object entity, String attributeName) {
-                // TODO Auto-generated dummy method stub
+                boolean isLoaded = true;
+
+                // Get the list of persistence providers from the resolver
+                PersistenceProviderResolver ppr = 
+                    PersistenceProviderResolverHolder.getPersistenceProviderResolver();
+                List<PersistenceProvider> pps = ppr.getPersistenceProviders();
+
+                // Iterate through the list using ProviderUtil.isLoadedWithoutReference()
+                for (PersistenceProvider pp : pps) {
+                    try {
+                        ProviderUtil pu = pp.getProviderUtil();                        
+                        LoadState ls = pu.isLoadedWithoutReference(entity, attributeName);
+                        if (ls == LoadState.LOADED)
+                            return true;
+                        if (ls == LoadState.NOT_LOADED)
+                            return false;
+                    }
+                    catch (Throwable t) {
+                        // JPA 1.0 providers will not implement the getProviderUtil
+                        // method.  Eat the exception and try the next provider.
+                    }
+                 }
+                // Iterate through the list a second time using ProviderUtil.isLoadedWithReference()
+                for (PersistenceProvider pp : pps) {
+                    try {
+                        ProviderUtil pu = pp.getProviderUtil();                        
+                        LoadState ls = pu.isLoadedWithoutReference(entity, attributeName);
+                        if (ls == LoadState.LOADED)
+                            return true;
+                        if (ls == LoadState.NOT_LOADED)
+                            return false;
+                    }
+                    catch (Throwable t) {
+                        // JPA 1.0 providers will not implement the getProviderUtil
+                        // method.  Eat the exception and try the next provider.
+                    }
+                 }
+                
+                // All providers returned a load state of unknown.  Return true.
                 return true;
             }
 
             public boolean isLoaded(Object entity) {
-                // TODO Auto-generated dummy method stub
+                // Get the list of persistence providers from the resolver
+                PersistenceProviderResolver ppr = 
+                    PersistenceProviderResolverHolder.getPersistenceProviderResolver();
+                List<PersistenceProvider> pps = ppr.getPersistenceProviders();
+
+                // Iterate through the list of providers, using ProviderUtil to
+                // determine the load state
+                for (PersistenceProvider pp : pps) {
+                    try {
+                        ProviderUtil pu = pp.getProviderUtil();
+                        LoadState ls = pu.isLoaded(entity);
+                        if (ls == LoadState.LOADED)
+                            return true;
+                        if (ls == LoadState.NOT_LOADED)
+                            return false;
+                        // Otherwise, load state is unknown.  Query the next provider.
+                    }
+                    catch (Throwable t) {
+                        // JPA 1.0 providers will not implement the getProviderUtil
+                        // method.  Eat the exception and try the next provider.
+                    }                   
+                }
+                
+                // All providers returned a load state of unknown.  Return true.
                 return true;
             }
     }

Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java?rev=797609&r1=797608&r2=797609&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java
(original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/Query.java
Fri Jul 24 19:08:09 2009
@@ -57,9 +57,9 @@
 
     <T> Query setParameter(Parameter<T> param, T value);
 
-    Query setParameter(Parameter<Date> param, Date value,  TemporalType temporalType);
+    Query setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
 
-    Query setParameter(Parameter<Calendar> param, Calendar value,  TemporalType temporalType);
+    Query setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
 
     Query setParameter(String name, Object value);
 
@@ -79,6 +79,12 @@
 
     Parameter<?> getParameter(int position);
 
+    <T> Parameter<T> getParameter(String name, Class<T> type);
+
+    <T> Parameter<T> getParameter(int position, Class<T> type);
+
+    boolean isBound(Parameter<?> param);
+
     <T> T getParameterValue(Parameter<T> param);
 
     Object getParameterValue(String name);

Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/TypedQuery.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/TypedQuery.java?rev=797609&r1=797608&r2=797609&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/TypedQuery.java
(original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/TypedQuery.java
Fri Jul 24 19:08:09 2009
@@ -60,10 +60,6 @@
 
     TypedQuery<X> setParameter(int position, Calendar value,  TemporalType temporalType);
 
-    <T> Parameter<T> getParameter(String name, Class<T> type);
-
-    <T> Parameter<T> getParameter(int position, Class<T> type);
-
      TypedQuery<X> setFlushMode(FlushModeType flushMode);
 
      TypedQuery<X> setLockMode(LockModeType lockMode);

Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/criteria/Order.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/criteria/Order.java?rev=797609&r1=797608&r2=797609&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/criteria/Order.java
(original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/criteria/Order.java
Fri Jul 24 19:08:09 2009
@@ -32,5 +32,5 @@
 
     boolean isAscending();
 
-   <T extends Comparable<T>> Expression<T> getExpression();
+   Expression<?> getExpression();
 }

Modified: geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/spi/PersistenceUnitInfo.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/spi/PersistenceUnitInfo.java?rev=797609&r1=797608&r2=797609&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/spi/PersistenceUnitInfo.java
(original)
+++ geronimo/specs/trunk/geronimo-jpa_2.0_spec/src/main/java/javax/persistence/spi/PersistenceUnitInfo.java
Fri Jul 24 19:08:09 2009
@@ -61,7 +61,7 @@
 
 	public Properties getProperties();
 
-	public String PersistenceXMLSchemaVersion();
+	public String getPersistenceXMLSchemaVersion();
 
 	public ClassLoader getClassLoader();
 



Mime
View raw message