OPENJPA-1202: Upgrade to Geronimo JPA 2.0 EA6

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@798684 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2009-07-28 19:49:03 +00:00
parent 7c4cf09bca
commit 76e82998f6
7 changed files with 22 additions and 12 deletions

View File

@ -48,7 +48,7 @@ public class ParameterImpl<T> implements QueryParameter<T> {
private final String _name;
private final Integer _position;
private final Class<?> _expectedValueType;
private Object _value;
private T _value;
private boolean _bound;
/**
@ -128,7 +128,7 @@ public class ParameterImpl<T> implements QueryParameter<T> {
*
* @exception if the given value is not permissible for this parameter.
*/
public QueryParameter<T> bindValue(Object v) {
public QueryParameter<T> bindValue(T v) {
if (!isValueAssignable(v)) {
if (v == null)
throw new IllegalArgumentException(_loc.get("param-null-not-assignable", this).getMessage());
@ -201,4 +201,9 @@ public class ParameterImpl<T> implements QueryParameter<T> {
return buf.toString();
}
public Class<T> getJavaType() {
Class<?> cls = _value.getClass();
return (Class<T>) cls;
}
}

View File

@ -518,7 +518,7 @@ public class PersistenceUnitInfoImpl
}
}
public String PersistenceXMLSchemaVersion() {
public String getPersistenceXMLSchemaVersion() {
return _schemaVersion;
}
@ -549,7 +549,6 @@ public class PersistenceUnitInfoImpl
}
public SharedCacheMode getSharedCacheMode() {
// TODO Auto-generated method stub
return null;
throw new UnsupportedOperationException("JPA 2.0 - Method not yet implemented");
}
}

View File

@ -90,6 +90,8 @@ public class QueryImpl<X> implements OpenJPAQuerySPI<X>, Serializable {
private transient ReentrantLock _lock = null;
private final HintHandler _hintHandler;
private Map<Parameter<?>, Object> parmatersToValues = new HashMap<Parameter<?>, Object>();
/**
* Constructor; supply factory exception translator and delegate.
*
@ -421,7 +423,7 @@ public class QueryImpl<X> implements OpenJPAQuerySPI<X>, Serializable {
position), null, null, false);
Class<?> valueType = (Class<?>)_query.getParameterTypes().get((Object)position);
ParameterImpl<?> param = new ParameterImpl<Object>(position, valueType);
ParameterImpl<Object> param = new ParameterImpl<Object>(position, valueType);
registerParameter(param);
param.bindValue(value);
@ -459,7 +461,7 @@ public class QueryImpl<X> implements OpenJPAQuerySPI<X>, Serializable {
}
Class<?> valueType = (Class<?>)_query.getParameterTypes().get(name);
ParameterImpl<?> param = new ParameterImpl<Object>(name, valueType);
ParameterImpl<Object> param = new ParameterImpl<Object>(name, valueType);
registerParameter(param);
param.bindValue(value);
@ -925,4 +927,8 @@ public class QueryImpl<X> implements OpenJPAQuerySPI<X>, Serializable {
return _query.getParameterTypes().keySet();
}
public boolean isBound(Parameter<?> param) {
return parmatersToValues.keySet().contains(param);
}
}

View File

@ -52,7 +52,7 @@ public interface QueryParameter<T> extends Parameter<T> {
/**
* Binds the given value to this parameter.
*/
public abstract QueryParameter<T> bindValue(Object v);
public abstract QueryParameter<T> bindValue(T v);
/**
* Gets the value of this parameter without checking whether the any value has been

View File

@ -40,8 +40,8 @@ public class OrderImpl implements Order {
this(e, true);
}
public <T extends Comparable<T>> Expression<T> getExpression() {
return (Expression<T>)e;
public Expression<?> getExpression() {
return e;
}
public Expression getExpression5() {

View File

@ -101,7 +101,7 @@ public class ParameterExpressionImpl<T> extends ExpressionImpl<T>
_delegate.clearBinding();
}
public final QueryParameter<T> bindValue(Object v) {
public final QueryParameter<T> bindValue(T v) {
return _delegate.bindValue(v);
}

View File

@ -492,7 +492,7 @@
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0-EA5-SNAPSHOT</version>
<version>1.0-EA6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>