mirror of https://github.com/apache/openjpa.git
OPENJPA-773 Updates for JPA 2.0 spec API. Stubbed out unimplemented methods.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@721073 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1617c44f57
commit
492a92a260
|
@ -28,6 +28,7 @@ import javax.persistence.*;
|
||||||
import org.apache.openjpa.jdbc.meta.strats.*;
|
import org.apache.openjpa.jdbc.meta.strats.*;
|
||||||
import org.apache.openjpa.persistence.*;
|
import org.apache.openjpa.persistence.*;
|
||||||
import org.apache.openjpa.persistence.jdbc.*;
|
import org.apache.openjpa.persistence.jdbc.*;
|
||||||
|
import org.apache.openjpa.persistence.jdbc.OrderColumn;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
|
|
@ -28,7 +28,10 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.Cache;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
|
import javax.persistence.QueryBuilder;
|
||||||
|
|
||||||
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||||
import org.apache.openjpa.enhance.Reflection;
|
import org.apache.openjpa.enhance.Reflection;
|
||||||
|
@ -332,4 +335,19 @@ public class EntityManagerFactoryImpl
|
||||||
throw PersistenceExceptions.toPersistenceException(e);
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,14 @@ import java.util.EnumSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.FlushModeType;
|
import javax.persistence.FlushModeType;
|
||||||
import javax.persistence.LockModeType;
|
import javax.persistence.LockModeType;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
import javax.persistence.QueryBuilder;
|
||||||
|
import javax.persistence.QueryDefinition;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||||
|
@ -1380,4 +1384,59 @@ public class EntityManagerImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.openjpa.persistence;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.persistence.FlushModeType;
|
import javax.persistence.FlushModeType;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
@ -133,16 +134,18 @@ public interface OpenJPAQuery
|
||||||
public boolean hasPositionalParameters();
|
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.
|
* 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
|
* The named parameters for the query; empty map if none or
|
||||||
* if query uses positional parameters.
|
* if query uses positional parameters.
|
||||||
*/
|
*/
|
||||||
public Map getNamedParameters();
|
public Map<String, Object> getNamedParameters();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set parameters.
|
* Set parameters.
|
||||||
|
|
|
@ -36,6 +36,7 @@ import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.persistence.FlushModeType;
|
import javax.persistence.FlushModeType;
|
||||||
|
import javax.persistence.LockModeType;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ import org.apache.openjpa.util.RuntimeExceptionTranslator;
|
||||||
*/
|
*/
|
||||||
public class QueryImpl implements OpenJPAQuerySPI, Serializable {
|
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);
|
private static final Localizer _loc = Localizer.forPackage(QueryImpl.class);
|
||||||
|
|
||||||
|
@ -673,21 +674,21 @@ public class QueryImpl implements OpenJPAQuerySPI, Serializable {
|
||||||
return _positional != null;
|
return _positional != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the array of positional parameter values. A value of
|
* Gets the list of positional parameter values. A value of
|
||||||
* <code>GAP_FILLER</code> indicates that user has not set the
|
* <code>GAP_FILLER</code> indicates that user has not set the
|
||||||
* corresponding positional parameter. A value of null implies that user has
|
* corresponding positional parameter. A value of null implies that user has
|
||||||
* set the value as null.
|
* set the value as null.
|
||||||
*/
|
*/
|
||||||
public Object[] getPositionalParameters() {
|
public List getPositionalParameters() {
|
||||||
_query.lock();
|
_query.lock();
|
||||||
try {
|
try {
|
||||||
return (_positional == null) ? EMPTY_ARRAY : _positional.values()
|
return (_positional == null) ? EMPTY_LIST :
|
||||||
.toArray();
|
new ArrayList<Object>(_positional.values());
|
||||||
} finally {
|
} finally {
|
||||||
_query.unlock();
|
_query.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenJPAQuery setParameters(Object... params) {
|
public OpenJPAQuery setParameters(Object... params) {
|
||||||
_query.assertOpen();
|
_query.assertOpen();
|
||||||
|
@ -705,7 +706,7 @@ public class QueryImpl implements OpenJPAQuerySPI, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getNamedParameters() {
|
public Map<String, Object> getNamedParameters() {
|
||||||
_query.lock();
|
_query.lock();
|
||||||
try {
|
try {
|
||||||
return (_named == null) ? Collections.EMPTY_MAP : Collections
|
return (_named == null) ? Collections.EMPTY_MAP : Collections
|
||||||
|
@ -751,4 +752,29 @@ public class QueryImpl implements OpenJPAQuerySPI, Serializable {
|
||||||
return false;
|
return false;
|
||||||
return _query.equals(((QueryImpl) other)._query);
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class QueryResultCacheImpl
|
||||||
QueryImpl impl = (QueryImpl) q;
|
QueryImpl impl = (QueryImpl) q;
|
||||||
if (impl.hasPositionalParameters())
|
if (impl.hasPositionalParameters())
|
||||||
return QueryKey.newInstance(impl.getDelegate(),
|
return QueryKey.newInstance(impl.getDelegate(),
|
||||||
impl.getPositionalParameters());
|
impl.getPositionalParameters().toArray());
|
||||||
return QueryKey.newInstance(impl.getDelegate(),
|
return QueryKey.newInstance(impl.getDelegate(),
|
||||||
impl.getNamedParameters());
|
impl.getNamedParameters());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue