You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2008/08/19 20:40:37 UTC
svn commit: r687120 [1/2] - in /openjpa/branches/1.2.x:
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/
openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/
openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-kernel/sr...
Author: ppoddar
Date: Tue Aug 19 11:40:34 2008
New Revision: 687120
URL: http://svn.apache.org/viewvc?rev=687120&view=rev
Log:
Rollback query parameter validation, temporal type conversion, eager query compilation and duplicate NamedQuery annotation changes from 1.2.x branch
Removed:
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/TestQueryParameterBinding.java
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/domain/Binder.java
Modified:
openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java
openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties
openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
openjpa/branches/1.2.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/TestNonPrimaryKeyQueryParameters.java
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity.java
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity2.java
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestDupNamedQuery.java
openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
openjpa/branches/1.2.x/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
openjpa/branches/1.2.x/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStoreManager.java
openjpa/branches/1.2.x/openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStoreQuery.java
Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java (original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java Tue Aug 19 11:40:34 2008
@@ -28,10 +28,8 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.openjpa.jdbc.meta.ClassMapping;
@@ -120,17 +118,13 @@
}
}
- int distinctParams = countDistinct(paramOrder);
- if (params.size() < distinctParams)
- throw new UserException(_loc.get("sqlquery-fewer-params",
- new Object[] {sql, distinctParams, params.size(), params}));
// now go through the paramOrder list and re-order the params array
List translated = new ArrayList();
for (Iterator i = paramOrder.iterator(); i.hasNext();) {
int index = ((Number) i.next()).intValue() - 1;
if (index >= params.size())
throw new UserException(_loc.get("sqlquery-missing-params",
- sql, String.valueOf(index+1), params));
+ sql, String.valueOf(index), params));
translated.add(params.get(index));
}
@@ -139,18 +133,6 @@
params.addAll(translated);
return buf.toString();
}
-
- static int countDistinct(List list) {
- if (list == null || list.isEmpty())
- return 0;
- int distinct = 0;
- Set set = new HashSet();
- for (Object o : list) {
- if (set.add(o))
- distinct++;
- }
- return distinct;
- }
public boolean supportsParameterDeclarations() {
return false;
Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties (original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties Tue Aug 19 11:40:34 2008
@@ -22,8 +22,6 @@
unjoined subclasses: {0}
sqlquery-missing-params: SQL query "{0}" declares a parameter index "{1}" for \
which no value was given. The given parameters were: {2}
-sqlquery-fewer-params: SQL query "{0}" declares {1} distinct parameter(s), \
- but only {2} parameters are given. Given parameter values are "{3}".
no-sql: You have not specified a SQL filter to execute in your SQL query.
del-ins-cycle: An unresolvable constraint cycle was detected. This typically \
means that you are persisting a new object with the same primary key value \
Modified: openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java (original)
+++ openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java Tue Aug 19 11:40:34 2008
@@ -908,11 +908,7 @@
else if (key instanceof Number) {
if (base == -1)
base = positionalParameterBase(params.keySet());
- int arrayIndex = ((Number) key).intValue() - base;
- if (arrayIndex >= arr.length)
- throw new UserException(_loc.get("gap-query-param",
- new Object[]{_query, key, params.size(), params}));
- arr[arrayIndex] = entry.getValue();
+ arr[((Number) key).intValue() - base] = entry.getValue();
} else
throw new UserException(_loc.get("bad-param-name", key));
}
Modified: openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java (original)
+++ openjpa/branches/1.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java Tue Aug 19 11:40:34 2008
@@ -1618,15 +1618,10 @@
ClassLoader envLoader) {
if (name == null)
return null;
- QueryMetaData qm = null;
- if (cls == null) {
- qm = searchQueryMetaDataByName(name);
- if (qm != null)
- return qm;
- }
+
// check cache
Object key = getQueryKey(cls, name);
- qm = (QueryMetaData) _queries.get(key);
+ QueryMetaData qm = (QueryMetaData) _queries.get(key);
if (qm != null)
return qm;
@@ -1699,18 +1694,6 @@
return false;
return _queries.remove(getQueryKey(cls, name)) != null;
}
-
- /**
- * Searches all cached query metadata by name.
- */
- public QueryMetaData searchQueryMetaDataByName(String name) {
- for (Object key : _queries.keySet()) {
- if (key instanceof QueryKey)
- if (StringUtils.equals(((QueryKey)key).name, name))
- return (QueryMetaData)_queries.get(key);
- }
- return null;
- }
/**
* Return a unique key for a given QueryMetaData.
Modified: openjpa/branches/1.2.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties (original)
+++ openjpa/branches/1.2.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties Tue Aug 19 11:40:34 2008
@@ -1,405 +1,402 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-cant-convert-result: There is no conversion between query projection type \
- "{0}" and result type "{1}".
-unloaded-detached: Attempt to access an unloaded field of detached instance \
- "{0}".
-meta-unknownid: Cannot manipulate identity of type "{0}": it''s identity type \
- is unknown.
-new-abstract: Cannot create an instance of "{0}": abstract classes are not \
- yet supported.
-bad-new-query: Attempt to construct a query from an extent or class. You must \
- pass a (possibly null) query string or template to the query factory \
- method when creating the query.
-update-restrict: Detected attempt to modify field "{0}" with value strategy \
- "restrict".
-reentrant-flush: Detected reentrant flush. Make sure your flush-time instance \
- callback methods or event listeners do not invoke any operations that \
- require the in-progress flush to complete.
-rolled-back: The transaction has been rolled back. See the nested exceptions \
- for details on the errors that occurred.
-bad-lock-level: This lock manager does not recognize lock level "{0}".
-pessimistic-mutate: You are attempting to directly mutate a persistent second \
- class object (such as a collection or map field) that you obtained before \
- the transaction began. After beginning a datastore transaction, you \
- must re-obtain any references to mutable second class objects from the \
- owning persistent object. Detected attempt to mutate value of field "{0}" \
- in instance "{1}". This instance may not be locked correctly.
-not-derefed: Encountered unknown dependent instance "{0}". This error is \
- often caused by either removing a dependent instance from one dependent \
- field, but not other dependent fields that reference it, or by removing a \
- dependent instance from its owning field, flushing \
- (causing the unreferenced dependent instance to be deleted), and then \
- trying to assign the deleted instance to another field before commit. \
- The instance cannot be un-deleted, resulting in an error. Make sure not \
- to leave dangling dependent references to objects, and to reassign \
- dependent objects before flush so that OpenJPA does not think they are \
- unreferenced and therefore safe to delete.
-init-null-pc: Attempt to initialize a state manager with a null \
- persistence-capable instance for type "{0}". This is often caused by \
- attempting to load an instance of an abstract class, or \
- neglecting to use a class indicator when the base persistence-capable \
- class in an inheritance tree is abstract.
-init-sm-pc: Attempt to initialize a state manager with an instance that is \
- already managed ("{0}"). You might be trying to persist this instance \
- in two threads at the same time.
-bad-ds-oid: The type "{0}" declares datastore identity but the value \
- passed to lookup of type "{1}" is not a OpenJPA id instance.
-null-oids: Some of the object ids passed to getObjectsById were null.
-marked-rollback: The transaction cannot be committed, because it was already \
- marked for rollback only. The transaction will be rolled back instead. \
- The cause of the rollback-only status is reported in the embedded stack.
-refresh-flushed: You cannot refresh an instance that has been flushed to the \
- data store.
-pc-loader-different: Attempt to cast instance "{0}" to PersistenceCapable failed. \
- The object implemented org.apache.openjpa.enhance.PersistenceCapable, \
- but the instance of that interface was loaded by two different ClassLoaders: \
- "{1}" and "{2}".
-pc-cast: Attempt to cast instance "{0}" to PersistenceCapable failed. Ensure \
- that it has been enhanced.
-del-instance: The instance of type "{0}" with oid "{1}" no longer exists in \
- the data store. This may mean that you deleted the instance in a separate \
- transaction, but this context still has a cached version.
-no-broker-class: The specified type "{0}" could not be loaded. Please ensure \
- that the class exists in the project class path.
-bad-embed: Attempt to set an embedded value for unembeddable field "{0}". \
- Please report this error to OpenJPA support.
-embed-ref: You are attempting to access an embedded object reference \
- that was obtained before the last transaction status change. After \
- transactions begin and end, all references to embedded objects become \
- invalid; you have to re-acquire the reference from the owning persistent \
- object.
-deleted: Operation attempted on a deleted instance.
-dirty: Illegal operation attempted on a dirty instance: dirty objects cannot \
- be evicted or made transient or non-transactional.
-nested-exceps: This operation failed for some instances. See the nested \
- exceptions array for details.
-new: Illegal operation attempted on a newly persisted instance: new objects \
- cannot be evicted or made transient or non-transactional.
-transient: Illegal operation attempted on a transient instance.
-not-active: Can only perform operation while a transaction is active.
-trans-active: The "{0}" transaction property cannot be set during an \
- active transaction.
-active: This operation cannot be performed while a Transaction is active.
-closed: The context has been closed. The stack trace at which the \
- context was closed is held in the embedded exception.
-closed-notrace: The context has been closed. The stack trace at which the \
- context was closed is available if Runtime=TRACE logging is enabled.
-closed-factory: The factory has been closed. The stack trace at \
- which the factory was closed is held in the embedded exception.
-closed-factory-notrace: The factory has been closed. The stack trace at \
- which the factory was closed is available if Runtime=TRACE logging is \
- enabled.
-non-trans-read: To perform reads on persistent data outside of a transaction, \
- the "NontransactionalRead" property must be set on the Transaction.
-non-trans-write: To perform writes on persistent data outside of a \
- transaction, the "NontransactionalWrite" property must be set to true.
-write-operation: To perform this operation, it must be written within a transaction, \
- or your settings must allow nontransactional writes and must not detach \
- all nontransactional reads.
-not-managed: The given instance "{0}" is not managed by this context.
-trans-not-managed: This broker is not configured to use managed transactions.
-bad-detached-op: You cannot perform operation {0} on detached object "{1}". \
- This operation only applies to managed objects.
-persist-detached: Attempt to persist detached object "{0}". If this is a new \
- instance, make sure any version and/or auto-generated primary key fields are \
- null/default when persisting.
-null-value: The field "{0}" of instance "{1}" contained a null value; \
- the metadata for this field specifies that nulls are illegal.
-change-identity: Attempt to change a primary key field of an instance that \
- already has a final object id. Only new, unflushed instances whose id you \
- have not retrieved can have their primary keys changed.
-managed-oid: You cannot assign managed object "{0}" to the primary key field \
- of "{1}". Embedded primary key values must be transient objects.
-changed-oid: You have modified the object id field of "{2}". Its old value \
- was "{0}", and its new value is "{1}". Object id fields are immutable \
- once the object id of the instance has been assigned.
-cache-exists: An object of type "{0}" with oid "{1}" already exists in this \
- context; another cannot be persisted.
-null-trans: Attempt to commit a null javax.transaction.Transaction. Some \
- application servers set the transaction to null if a rollback occurs.
-end-trans-error: An exception occurred while ending the transaction. This \
- exception will be re-thrown.
-not-bound: The file named "{0}" could not be found.
-naming-exception: A NamingException was thrown while obtaining the \
- factory at "{0}" from JNDI.
-attach-deleted: The object "{0}" with id "{1}" has been deleted and \
- cannot be attached.
-not-detachable: The class "{0}" does not declare the "detachable" metadata \
- extension, so cannot be detached.
-not-copyable: Attempt to copy field "{0}" failed. The field is \
- not copyable. This can occur with custom SCO types. Only standard or \
- immutable SCO types can be attached and detached.
-no-detach-object-id: Cannot access the detached object id of class "{0}". \
- Ensure that the class has the "detachable" metadata extension, and \
- the the class has been re-enhanced.
-attach-version-del: Attempted to attach deleted instance type "{0}" with oid \
- "{1}". If the instance is new, the version field should be left to its \
- default value.
-attach-wrongclass: Attempted to attach instance "{0}" of type "{1}", but this \
- instance is already in the datastore as type "{2}".
-sjvm-acquired-lock: Acquired an exclusive lock "{0}" on oid "{1}".
-sjvm-released-lock: Released lock "{0}".
-conn-not-supported: This data store cannot return connections.
-incremental-flush-not-supported: This data store does not support incremental \
- flushing. If you got this error while performing a query, make sure that \
- you have not set the FlushBeforeQueries option to true, either by \
- setting that option in your configuration file, or by programmatically \
- setting the current FetchConfiguration''s FlushBeforeQueries property \
- to QueryFlushModes.FLUSH_TRUE.
-nontrans-read-not-supported: This data store does not support nontransactional \
- reads. Set the NontransactionalRead property to false.
-optimistic-not-supported: This datastore does not support optimistic \
- transactions. Set the Optimistic property to false.
-restore-unset: The RestoreValues option is off, so initial values are \
- not available. Turn on RestoreValues to be able to obtain initial \
- values.
-mutable-restore-unset: The RestoreValues option is not set to "all", \
- initial values of mutable fields are not available. Set RestoreValues to \
- "all" in your properties to be able to obtain initial mutable values.
-initial-unloaded: OpenJPA cannot provide the initial value for field "{0}" \
- because the field was never loaded before being changed.
-dup-oid-assign: Attempt to assign id "{0}" to new instance "{1}" failed; \
- there is already an object in the L1 cache with this id. \
- You must delete this object (in a previous transaction or the current one) \
- before reusing its id. This error can also occur when a horizontally \
- or vertically mapped classes uses auto-increment application identity and \
- does not use a hierarchy of application identity classes.
-dup-load: Cannot load object with id "{0}". Instance "{1}" with the same id \
- already exists in the L1 cache. This can occur when you \
- assign an existing id to a new instance, and before flushing attempt to \
- load the existing instance for that id.
-bad-id-value: The given value "{0}" cannot be converted into an identity \
- for "{2}". The value is the wrong type ({1}).
-factory-init: Starting OpenJPA {0}
-factory-properties: Properties: {0}
-inverse-consistency: An inverse inconsistency in the object model was \
- detected while flushing the field "{0}" of the instance with id "{1}" \
- in context "{2}".
-no-brokerfactory: You did not name the factory class with the required \
- property openjpa.BrokerFactory. Normally this property defaults \
- appropriately; have you forgotten to include all the OpenJPA jars in your \
- classpath?
-brokerfactory-excep: There was an error when invoking the static \
- getInstance method on the named factory class "{0}". See the \
- nested exception for details.
-new-brokerfactory-excep: There was an error when invoking the static \
- newInstance method on the named factory class "{0}". See the \
- nested exception for details.
-bad-brokerfactory: Could not invoke the static getInstance method on the \
- named factory class "{0}".
-bad-new-brokerfactory: Could not invoke the static newInstance method on the \
- named factory class "{0}".
-bad-brokerfactory-class: The named BrokerFactory "{0}" is not valid.
-instantiate-abstract: Cannot instantiate abstract class of type "{0}" with \
- object id "{1}"; this may indicate that the inheritance discriminator \
- for the class is not configured correctly.
-nontrans-proxied: You cannot make a property access object created with "new" \
- nontransactional.
-no-field: Field "{0}" is not declared in "{1}", or is not managed.
-no-field-index: "{0}" is not the index of any managed field in "{1}".
-cant-cascade-persist: Encountered unmanaged object in persistent field \
- "{0}" during flush. However, this field does not \
- allow cascade persist. Set the cascade attribute for this field to \
- CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or \
- "persist" or "all" (JPA orm.xml), or enable cascade-persist globally, \
- or manually persist the related field value prior to flushing. \
- You cannot flush unmanaged objects or graphs that have persistent \
- associations to unmanaged objects.
-cant-cascade-attach: Encountered new object in persistent field \
- "{0}" during attach. However, this field does not \
- allow cascade attach. Set the cascade attribute for this field to \
- CascadeType.MERGE or CascadeType.ALL (JPA annotations) or \
- "merge" or "all" (JPA orm.xml). \
- You cannot attach a reference to a new object without cascading.
-ref-to-deleted: Encountered deleted object "{0}" in persistent field \
- "{1}" of managed object "{2}" during flush.
-no-version-field: Encountered object "{0}" without a version field during \
- attach. In order to attach an object, it must either be enhanced or must \
- have a version field.
-inmem-agg-proj-var: Queries with aggregates or projections using variables \
- currently cannot be executed in-memory. Either set IgnoreCache to true, \
- set the openjpa.FlushBeforeQueries property to true, or execute the query \
- before changing any instances in the transaction. The offending query was \
- on type "{0}" with filter "{1}".
-merged-order-with-result: This query on candidate type "{0}" with filter "{1}" \
- involves combining the results of multiple queries in memory. \
- You have chosen to order the results on "{2}", but you have not selected \
- this data in your setResult() clause. Please include this ordering data \
- in setResult() so that OpenJPA can extract it for in-memory ordering.
-bad-grouping: Your query on type "{0}" with filter "{1}" is invalid. Your \
- select and having clauses must only include aggregates or values that also \
- appear in your grouping clause.
-query-nosupport: The "{0}" query type does not support this operation.
-query-unmapped: You cannot query unmapped type "{0}".
-range-too-big: The range of the query is too big. Start index: "{0}", end \
- index: "{1}". The range must be less than Integer.MAX_VALUE.
-invalid-range: The query range from {0} to {1} is not valid.
-no-impls: Unable to execute a query on type "{0}". This class or interface \
- is not mapped, and does not have any mapped implementors.
-bad-param-name: The parameter name or position "{0}" passed to \
- execute() is not valid. All map keys must be a declared parameter \
- name or a number matching the parameter position. Native queries only \
- allow the use of positional parameters.
-force-in-mem: This query on type "{0}" must load the entire candidate class \
- extent and evaluate the query in-memory. This may be very slow. The \
- query must be executed in memory because OpenJPA is configured with \
- IgnoreCache=false and FlushBeforeQueries=false and \
- there are dirty instances that may affect the query''s outcome in the \
- cache.
-cant-exec-inmem: Queries of this type ("{0}") cannot be executed in-memory. \
- Either set IgnoreCache to true, set the openjpa.FlushBeforeQueries \
- property to true, or execute the query before changing any instances in \
- the transaction.
-executing-query: Executing query: {0}
-executing-query-with-params: Executing query: [{0}] with parameters: {1}
-not-unique: The query on candidate type "{0}" with filter "{1}" was \
- configured to have a unique result, but more than one instance matched \
- the query.
-no-result: The query on candidate type "{0}" with filter "{1}" was \
- configured to have a unique result, but no instance matched \
- the query.
-serialized: Queries that have been serialized do not support this operation.
-read-only: Attempt to modify a read-only query object.
-no-class: A candidate Class must be specified before executing a query.
-no-modify-resultclass: A query that declares a result class cannot be used \
- to perform bulk updates.
-no-modify-unique: A query that declares unique results cannot be used \
- to perform bulk updates.
-no-modify-range: A query that declares a result range cannot be used \
- to perform bulk updates.
-unbound-param: Cannot execute query; the declared parameter "{0}" was \
- not given a value.
-unbound-params: Cannot execute query; some declared parameters were not given \
- values. You must supply a value for each of the following parameters, \
- in the given order: {0}
-extra-params: More parameters were passed to execute() than were declared: \
- {1} parameters were specified for query execution, but only {0} \
- parameters were declared in the query.
-null-primitive-param: Parameter "{0}" was declared with a primitive type, but \
- has been given a null value.
-merged-aggregate: This query on candidate type "{0}" with filter "{1}" \
- involves combining the results of multiple sub-queries. However, because \
- this query is for aggregate data, OpenJPA cannot combine the sub-query \
- aggregates into correct final values.
-bad-dec: The {1} declaration "{0}" is \
- not valid. Variables and imports must be delimited with ";". Parameters \
- and orderings must be delimited with ",". Imports require the "import" \
- keyword, and orderings require the "ascending" or "descending" keyword.
-mod-bigdecimal: You cannot use the modulo operator (%) on numbers of type \
- BigDecimal.
-cant-convert: Cannot convert object "{0}" of type "{1}" into an instance of \
- "{2}".
-bad-method-class: You set the method name of this openjpa.MethodQL query to \
- "{1}", but class "{0}" is not a valid class name. Make sure to fully \
- qualify the class name or to import its package into this query if the \
- class is not in the query candidate class'' package.
-method-not-static: Method "{0}" named in the MethodQL query must be static.
-method-return-type-invalid: Method "{0}" named in the MethodQL query must \
- have a return type that is assignable from ResultObjectProvider. Return \
- type is: {1}.
-no-method: You must set the query filter to the name of the method to execute \
- for this MethodQL query instance.
-method-error: There was an error invoking method "{0}" with arguments "{1}".
-bad-param-type: The type "{0}" as used in the parameter declarations \
- could not be found in the imports.
-cant-set: Result type "{0}" does not have any public fields or setter methods \
- for the projection or aggregate result element "{1}", nor does it have a \
- generic put(Object,Object) method that can be used, nor does it have a \
- public constructor that takes the types {2}.
-pack-err: There was an error packing the projection and/or aggregate results \
- of the query into result type "{0}". See the nested Throwable exception \
- for details.
-pack-instantiation-err: There was an error creating an instance of type "{0}" \
- when packing the projection and/or aggregate results of the query. Ensure \
- that you have defined a public no-args constructor in "{0}".
-bad-inmem-method: Method "{0}(StoreContext, ClassMetaData, boolean, Object, \
- Map, FetchConfiguration)" is not declared in type "{1}". \
- Check the method name supplied in your MethodQL query filter. \
- OpenJPA is attempting to execute this query in-memory; if you implemented \
- the datastore method instead (a method with the same signature but without \
- the Object argument) and want this query to execute in the datastore, \
- either create the query before modifying objects in the current transaction, \
- set IgnoreCache to true, or set the openjpa.FlushBeforeQueries property to \
- true.
-bad-datastore-method: Method "{0}(StoreContext, ClassMetaData, boolean, Map, \
- FetchConfiguration)" is not declared in type "{1}". Check \
- the method name supplied in your MethodQL query filter. OpenJPA is \
- attempting to execute this query against the datastore; if you implemented \
- the in-memory method instead (a method with the same signature but with an \
- Object argument) and want this query to execute in-memory, supply a \
- Collection of candidates to filter.
-only-update-constants: Bulk update queries when executed in memory \
- may only update to constant values.
-only-range-constants: Range values must be numeric constants. Illegal query: \
- {0}
-no-savepoint-copy: Unable to copy field "{0}" for savepoint.
-savepoint-exists: A savepoint with the name "{0}" already exists. \
- Each savepoint name must be unique.
-no-lastsavepoint: Cannot rollback/release last savepoint as no savepoint \
- has been set.
-no-savepoint: You have not set a savepoint with the name "{0}"
-savepoint-init: This savepoint has already been initialized.
-savepoint-flush-not-supported: The configured SavepointManager does not \
- support incremental flushing when a savepoint has been set. You must \
- release your savepoints before flushing.
-callback-err: Errors occurred processing listener callbacks. See the nested \
- exceptions for details.
-bad-agg-listener-hint: Query hint value "{0}" ({1}) cannot be converted into \
- an aggregate listener.
-bad-filter-listener-hint: Query hint value "{0}" ({1}) cannot be converted \
- into a filter listener.
-bad-setter-hint-arg: In query hint "{0}", cannot convert hint value "{1}" to \
- type "{2}".
-detach-val-mismatch: The instance "{0}" is managed by another context and \
- cannot be inspected for field values.
-detach-val-badsm: The instance "{0}" has an unknown state manager which \
- prevents field inspection.
-null-oid: Cannot perform find using null object id.
-illegal-op-in-prestore: This operation is illegal when called during \
- transaction completion.
-no-expressions: The query cannot be executed because it has no \
- valid expressions.
-null-fg: Attempt to add null/empty fetch group name to fetch configuration.
-null-field: Attempt to add null/empty field name to fetch configuration.
-container-projection: Query projections cannot include array, collection, or \
- map fields. Invalid query: "{0}"
-existing-value-override-excep: The generated value processing detected an \
-existing value assigned to this field: {0}. This existing value was either \
-provided via an initializer or by calling the setter method. You either need \
-to remove the @GeneratedValue annotation or modify the code to remove the \
-initializer processing.
-invalid-tran-status: The transaction was not in a valid state ({0}) to \
-accept the "{1}" method invocation. Processing will continue.
-multi-threaded-access: Multiple concurrent threads attempted to access a \
- single broker. By default brokers are not thread safe; if you require \
- and/or intend a broker to be accessed by more than one thread, set the \
- openjpa.Multithreaded property to true to override the default behavior.
-no-saved-fields: No state snapshot is available for instance of type "{0}", \
- but this instance uses state-comparison for dirty detection.
-cant-serialize-flushed-broker: Serialization not allowed once a broker has \
- been flushed.
-cant-serialize-pessimistic-broker: Serialization not allowed for brokers with \
- an active datastore (pessimistic) transaction.
-cant-serialize-connected-broker: Serialization not allowed for brokers with \
- an active connection to the database.
-no-interface-metadata: No metadata was found for managed interface {0}.
-fetch-configuration-stack-empty: Fetch configuration stack is empty.
-gap-query-param: Parameter {1} for query "{0}" exceeds the number of {2} \
- bound parameters with following values "{3}". This can happen if you have \
- declared but missed to bind values for one or more parameters.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+cant-convert-result: There is no conversion between query projection type \
+ "{0}" and result type "{1}".
+unloaded-detached: Attempt to access an unloaded field of detached instance \
+ "{0}".
+meta-unknownid: Cannot manipulate identity of type "{0}": it''s identity type \
+ is unknown.
+new-abstract: Cannot create an instance of "{0}": abstract classes are not \
+ yet supported.
+bad-new-query: Attempt to construct a query from an extent or class. You must \
+ pass a (possibly null) query string or template to the query factory \
+ method when creating the query.
+update-restrict: Detected attempt to modify field "{0}" with value strategy \
+ "restrict".
+reentrant-flush: Detected reentrant flush. Make sure your flush-time instance \
+ callback methods or event listeners do not invoke any operations that \
+ require the in-progress flush to complete.
+rolled-back: The transaction has been rolled back. See the nested exceptions \
+ for details on the errors that occurred.
+bad-lock-level: This lock manager does not recognize lock level "{0}".
+pessimistic-mutate: You are attempting to directly mutate a persistent second \
+ class object (such as a collection or map field) that you obtained before \
+ the transaction began. After beginning a datastore transaction, you \
+ must re-obtain any references to mutable second class objects from the \
+ owning persistent object. Detected attempt to mutate value of field "{0}" \
+ in instance "{1}". This instance may not be locked correctly.
+not-derefed: Encountered unknown dependent instance "{0}". This error is \
+ often caused by either removing a dependent instance from one dependent \
+ field, but not other dependent fields that reference it, or by removing a \
+ dependent instance from its owning field, flushing \
+ (causing the unreferenced dependent instance to be deleted), and then \
+ trying to assign the deleted instance to another field before commit. \
+ The instance cannot be un-deleted, resulting in an error. Make sure not \
+ to leave dangling dependent references to objects, and to reassign \
+ dependent objects before flush so that OpenJPA does not think they are \
+ unreferenced and therefore safe to delete.
+init-null-pc: Attempt to initialize a state manager with a null \
+ persistence-capable instance for type "{0}". This is often caused by \
+ attempting to load an instance of an abstract class, or \
+ neglecting to use a class indicator when the base persistence-capable \
+ class in an inheritance tree is abstract.
+init-sm-pc: Attempt to initialize a state manager with an instance that is \
+ already managed ("{0}"). You might be trying to persist this instance \
+ in two threads at the same time.
+bad-ds-oid: The type "{0}" declares datastore identity but the value \
+ passed to lookup of type "{1}" is not a OpenJPA id instance.
+null-oids: Some of the object ids passed to getObjectsById were null.
+marked-rollback: The transaction cannot be committed, because it was already \
+ marked for rollback only. The transaction will be rolled back instead. \
+ The cause of the rollback-only status is reported in the embedded stack.
+refresh-flushed: You cannot refresh an instance that has been flushed to the \
+ data store.
+pc-loader-different: Attempt to cast instance "{0}" to PersistenceCapable failed. \
+ The object implemented org.apache.openjpa.enhance.PersistenceCapable, \
+ but the instance of that interface was loaded by two different ClassLoaders: \
+ "{1}" and "{2}".
+pc-cast: Attempt to cast instance "{0}" to PersistenceCapable failed. Ensure \
+ that it has been enhanced.
+del-instance: The instance of type "{0}" with oid "{1}" no longer exists in \
+ the data store. This may mean that you deleted the instance in a separate \
+ transaction, but this context still has a cached version.
+no-broker-class: The specified type "{0}" could not be loaded. Please ensure \
+ that the class exists in the project class path.
+bad-embed: Attempt to set an embedded value for unembeddable field "{0}". \
+ Please report this error to OpenJPA support.
+embed-ref: You are attempting to access an embedded object reference \
+ that was obtained before the last transaction status change. After \
+ transactions begin and end, all references to embedded objects become \
+ invalid; you have to re-acquire the reference from the owning persistent \
+ object.
+deleted: Operation attempted on a deleted instance.
+dirty: Illegal operation attempted on a dirty instance: dirty objects cannot \
+ be evicted or made transient or non-transactional.
+nested-exceps: This operation failed for some instances. See the nested \
+ exceptions array for details.
+new: Illegal operation attempted on a newly persisted instance: new objects \
+ cannot be evicted or made transient or non-transactional.
+transient: Illegal operation attempted on a transient instance.
+not-active: Can only perform operation while a transaction is active.
+trans-active: The "{0}" transaction property cannot be set during an \
+ active transaction.
+active: This operation cannot be performed while a Transaction is active.
+closed: The context has been closed. The stack trace at which the \
+ context was closed is held in the embedded exception.
+closed-notrace: The context has been closed. The stack trace at which the \
+ context was closed is available if Runtime=TRACE logging is enabled.
+closed-factory: The factory has been closed. The stack trace at \
+ which the factory was closed is held in the embedded exception.
+closed-factory-notrace: The factory has been closed. The stack trace at \
+ which the factory was closed is available if Runtime=TRACE logging is \
+ enabled.
+non-trans-read: To perform reads on persistent data outside of a transaction, \
+ the "NontransactionalRead" property must be set on the Transaction.
+non-trans-write: To perform writes on persistent data outside of a \
+ transaction, the "NontransactionalWrite" property must be set to true.
+write-operation: To perform this operation, it must be written within a transaction, \
+ or your settings must allow nontransactional writes and must not detach \
+ all nontransactional reads.
+not-managed: The given instance "{0}" is not managed by this context.
+trans-not-managed: This broker is not configured to use managed transactions.
+bad-detached-op: You cannot perform operation {0} on detached object "{1}". \
+ This operation only applies to managed objects.
+persist-detached: Attempt to persist detached object "{0}". If this is a new \
+ instance, make sure any version and/or auto-generated primary key fields are \
+ null/default when persisting.
+null-value: The field "{0}" of instance "{1}" contained a null value; \
+ the metadata for this field specifies that nulls are illegal.
+change-identity: Attempt to change a primary key field of an instance that \
+ already has a final object id. Only new, unflushed instances whose id you \
+ have not retrieved can have their primary keys changed.
+managed-oid: You cannot assign managed object "{0}" to the primary key field \
+ of "{1}". Embedded primary key values must be transient objects.
+changed-oid: You have modified the object id field of "{2}". Its old value \
+ was "{0}", and its new value is "{1}". Object id fields are immutable \
+ once the object id of the instance has been assigned.
+cache-exists: An object of type "{0}" with oid "{1}" already exists in this \
+ context; another cannot be persisted.
+null-trans: Attempt to commit a null javax.transaction.Transaction. Some \
+ application servers set the transaction to null if a rollback occurs.
+end-trans-error: An exception occurred while ending the transaction. This \
+ exception will be re-thrown.
+not-bound: The file named "{0}" could not be found.
+naming-exception: A NamingException was thrown while obtaining the \
+ factory at "{0}" from JNDI.
+attach-deleted: The object "{0}" with id "{1}" has been deleted and \
+ cannot be attached.
+not-detachable: The class "{0}" does not declare the "detachable" metadata \
+ extension, so cannot be detached.
+not-copyable: Attempt to copy field "{0}" failed. The field is \
+ not copyable. This can occur with custom SCO types. Only standard or \
+ immutable SCO types can be attached and detached.
+no-detach-object-id: Cannot access the detached object id of class "{0}". \
+ Ensure that the class has the "detachable" metadata extension, and \
+ the the class has been re-enhanced.
+attach-version-del: Attempted to attach deleted instance type "{0}" with oid \
+ "{1}". If the instance is new, the version field should be left to its \
+ default value.
+attach-wrongclass: Attempted to attach instance "{0}" of type "{1}", but this \
+ instance is already in the datastore as type "{2}".
+sjvm-acquired-lock: Acquired an exclusive lock "{0}" on oid "{1}".
+sjvm-released-lock: Released lock "{0}".
+conn-not-supported: This data store cannot return connections.
+incremental-flush-not-supported: This data store does not support incremental \
+ flushing. If you got this error while performing a query, make sure that \
+ you have not set the FlushBeforeQueries option to true, either by \
+ setting that option in your configuration file, or by programmatically \
+ setting the current FetchConfiguration''s FlushBeforeQueries property \
+ to QueryFlushModes.FLUSH_TRUE.
+nontrans-read-not-supported: This data store does not support nontransactional \
+ reads. Set the NontransactionalRead property to false.
+optimistic-not-supported: This datastore does not support optimistic \
+ transactions. Set the Optimistic property to false.
+restore-unset: The RestoreValues option is off, so initial values are \
+ not available. Turn on RestoreValues to be able to obtain initial \
+ values.
+mutable-restore-unset: The RestoreValues option is not set to "all", \
+ initial values of mutable fields are not available. Set RestoreValues to \
+ "all" in your properties to be able to obtain initial mutable values.
+initial-unloaded: OpenJPA cannot provide the initial value for field "{0}" \
+ because the field was never loaded before being changed.
+dup-oid-assign: Attempt to assign id "{0}" to new instance "{1}" failed; \
+ there is already an object in the L1 cache with this id. \
+ You must delete this object (in a previous transaction or the current one) \
+ before reusing its id. This error can also occur when a horizontally \
+ or vertically mapped classes uses auto-increment application identity and \
+ does not use a hierarchy of application identity classes.
+dup-load: Cannot load object with id "{0}". Instance "{1}" with the same id \
+ already exists in the L1 cache. This can occur when you \
+ assign an existing id to a new instance, and before flushing attempt to \
+ load the existing instance for that id.
+bad-id-value: The given value "{0}" cannot be converted into an identity \
+ for "{2}". The value is the wrong type ({1}).
+factory-init: Starting OpenJPA {0}
+factory-properties: Properties: {0}
+inverse-consistency: An inverse inconsistency in the object model was \
+ detected while flushing the field "{0}" of the instance with id "{1}" \
+ in context "{2}".
+no-brokerfactory: You did not name the factory class with the required \
+ property openjpa.BrokerFactory. Normally this property defaults \
+ appropriately; have you forgotten to include all the OpenJPA jars in your \
+ classpath?
+brokerfactory-excep: There was an error when invoking the static \
+ getInstance method on the named factory class "{0}". See the \
+ nested exception for details.
+new-brokerfactory-excep: There was an error when invoking the static \
+ newInstance method on the named factory class "{0}". See the \
+ nested exception for details.
+bad-brokerfactory: Could not invoke the static getInstance method on the \
+ named factory class "{0}".
+bad-new-brokerfactory: Could not invoke the static newInstance method on the \
+ named factory class "{0}".
+bad-brokerfactory-class: The named BrokerFactory "{0}" is not valid.
+instantiate-abstract: Cannot instantiate abstract class of type "{0}" with \
+ object id "{1}"; this may indicate that the inheritance discriminator \
+ for the class is not configured correctly.
+nontrans-proxied: You cannot make a property access object created with "new" \
+ nontransactional.
+no-field: Field "{0}" is not declared in "{1}", or is not managed.
+no-field-index: "{0}" is not the index of any managed field in "{1}".
+cant-cascade-persist: Encountered unmanaged object in persistent field \
+ "{0}" during flush. However, this field does not \
+ allow cascade persist. Set the cascade attribute for this field to \
+ CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or \
+ "persist" or "all" (JPA orm.xml), or enable cascade-persist globally, \
+ or manually persist the related field value prior to flushing. \
+ You cannot flush unmanaged objects or graphs that have persistent \
+ associations to unmanaged objects.
+cant-cascade-attach: Encountered new object in persistent field \
+ "{0}" during attach. However, this field does not \
+ allow cascade attach. Set the cascade attribute for this field to \
+ CascadeType.MERGE or CascadeType.ALL (JPA annotations) or \
+ "merge" or "all" (JPA orm.xml). \
+ You cannot attach a reference to a new object without cascading.
+ref-to-deleted: Encountered deleted object "{0}" in persistent field \
+ "{1}" of managed object "{2}" during flush.
+no-version-field: Encountered object "{0}" without a version field during \
+ attach. In order to attach an object, it must either be enhanced or must \
+ have a version field.
+inmem-agg-proj-var: Queries with aggregates or projections using variables \
+ currently cannot be executed in-memory. Either set IgnoreCache to true, \
+ set the openjpa.FlushBeforeQueries property to true, or execute the query \
+ before changing any instances in the transaction. The offending query was \
+ on type "{0}" with filter "{1}".
+merged-order-with-result: This query on candidate type "{0}" with filter "{1}" \
+ involves combining the results of multiple queries in memory. \
+ You have chosen to order the results on "{2}", but you have not selected \
+ this data in your setResult() clause. Please include this ordering data \
+ in setResult() so that OpenJPA can extract it for in-memory ordering.
+bad-grouping: Your query on type "{0}" with filter "{1}" is invalid. Your \
+ select and having clauses must only include aggregates or values that also \
+ appear in your grouping clause.
+query-nosupport: The "{0}" query type does not support this operation.
+query-unmapped: You cannot query unmapped type "{0}".
+range-too-big: The range of the query is too big. Start index: "{0}", end \
+ index: "{1}". The range must be less than Integer.MAX_VALUE.
+invalid-range: The query range from {0} to {1} is not valid.
+no-impls: Unable to execute a query on type "{0}". This class or interface \
+ is not mapped, and does not have any mapped implementors.
+bad-param-name: The parameter name or position "{0}" passed to \
+ execute() is not valid. All map keys must be a declared parameter \
+ name or a number matching the parameter position. Native queries only \
+ allow the use of positional parameters.
+force-in-mem: This query on type "{0}" must load the entire candidate class \
+ extent and evaluate the query in-memory. This may be very slow. The \
+ query must be executed in memory because OpenJPA is configured with \
+ IgnoreCache=false and FlushBeforeQueries=false and \
+ there are dirty instances that may affect the query''s outcome in the \
+ cache.
+cant-exec-inmem: Queries of this type ("{0}") cannot be executed in-memory. \
+ Either set IgnoreCache to true, set the openjpa.FlushBeforeQueries \
+ property to true, or execute the query before changing any instances in \
+ the transaction.
+executing-query: Executing query: {0}
+executing-query-with-params: Executing query: [{0}] with parameters: {1}
+not-unique: The query on candidate type "{0}" with filter "{1}" was \
+ configured to have a unique result, but more than one instance matched \
+ the query.
+no-result: The query on candidate type "{0}" with filter "{1}" was \
+ configured to have a unique result, but no instance matched \
+ the query.
+serialized: Queries that have been serialized do not support this operation.
+read-only: Attempt to modify a read-only query object.
+no-class: A candidate Class must be specified before executing a query.
+no-modify-resultclass: A query that declares a result class cannot be used \
+ to perform bulk updates.
+no-modify-unique: A query that declares unique results cannot be used \
+ to perform bulk updates.
+no-modify-range: A query that declares a result range cannot be used \
+ to perform bulk updates.
+unbound-param: Cannot execute query; the declared parameter "{0}" was \
+ not given a value.
+unbound-params: Cannot execute query; some declared parameters were not given \
+ values. You must supply a value for each of the following parameters, \
+ in the given order: {0}
+extra-params: More parameters were passed to execute() than were declared: \
+ {1} parameters were specified for query execution, but only {0} \
+ parameters were declared in the query.
+null-primitive-param: Parameter "{0}" was declared with a primitive type, but \
+ has been given a null value.
+merged-aggregate: This query on candidate type "{0}" with filter "{1}" \
+ involves combining the results of multiple sub-queries. However, because \
+ this query is for aggregate data, OpenJPA cannot combine the sub-query \
+ aggregates into correct final values.
+bad-dec: The {1} declaration "{0}" is \
+ not valid. Variables and imports must be delimited with ";". Parameters \
+ and orderings must be delimited with ",". Imports require the "import" \
+ keyword, and orderings require the "ascending" or "descending" keyword.
+mod-bigdecimal: You cannot use the modulo operator (%) on numbers of type \
+ BigDecimal.
+cant-convert: Cannot convert object "{0}" of type "{1}" into an instance of \
+ "{2}".
+bad-method-class: You set the method name of this openjpa.MethodQL query to \
+ "{1}", but class "{0}" is not a valid class name. Make sure to fully \
+ qualify the class name or to import its package into this query if the \
+ class is not in the query candidate class'' package.
+method-not-static: Method "{0}" named in the MethodQL query must be static.
+method-return-type-invalid: Method "{0}" named in the MethodQL query must \
+ have a return type that is assignable from ResultObjectProvider. Return \
+ type is: {1}.
+no-method: You must set the query filter to the name of the method to execute \
+ for this MethodQL query instance.
+method-error: There was an error invoking method "{0}" with arguments "{1}".
+bad-param-type: The type "{0}" as used in the parameter declarations \
+ could not be found in the imports.
+cant-set: Result type "{0}" does not have any public fields or setter methods \
+ for the projection or aggregate result element "{1}", nor does it have a \
+ generic put(Object,Object) method that can be used, nor does it have a \
+ public constructor that takes the types {2}.
+pack-err: There was an error packing the projection and/or aggregate results \
+ of the query into result type "{0}". See the nested Throwable exception \
+ for details.
+pack-instantiation-err: There was an error creating an instance of type "{0}" \
+ when packing the projection and/or aggregate results of the query. Ensure \
+ that you have defined a public no-args constructor in "{0}".
+bad-inmem-method: Method "{0}(StoreContext, ClassMetaData, boolean, Object, \
+ Map, FetchConfiguration)" is not declared in type "{1}". \
+ Check the method name supplied in your MethodQL query filter. \
+ OpenJPA is attempting to execute this query in-memory; if you implemented \
+ the datastore method instead (a method with the same signature but without \
+ the Object argument) and want this query to execute in the datastore, \
+ either create the query before modifying objects in the current transaction, \
+ set IgnoreCache to true, or set the openjpa.FlushBeforeQueries property to \
+ true.
+bad-datastore-method: Method "{0}(StoreContext, ClassMetaData, boolean, Map, \
+ FetchConfiguration)" is not declared in type "{1}". Check \
+ the method name supplied in your MethodQL query filter. OpenJPA is \
+ attempting to execute this query against the datastore; if you implemented \
+ the in-memory method instead (a method with the same signature but with an \
+ Object argument) and want this query to execute in-memory, supply a \
+ Collection of candidates to filter.
+only-update-constants: Bulk update queries when executed in memory \
+ may only update to constant values.
+only-range-constants: Range values must be numeric constants. Illegal query: \
+ {0}
+no-savepoint-copy: Unable to copy field "{0}" for savepoint.
+savepoint-exists: A savepoint with the name "{0}" already exists. \
+ Each savepoint name must be unique.
+no-lastsavepoint: Cannot rollback/release last savepoint as no savepoint \
+ has been set.
+no-savepoint: You have not set a savepoint with the name "{0}"
+savepoint-init: This savepoint has already been initialized.
+savepoint-flush-not-supported: The configured SavepointManager does not \
+ support incremental flushing when a savepoint has been set. You must \
+ release your savepoints before flushing.
+callback-err: Errors occurred processing listener callbacks. See the nested \
+ exceptions for details.
+bad-agg-listener-hint: Query hint value "{0}" ({1}) cannot be converted into \
+ an aggregate listener.
+bad-filter-listener-hint: Query hint value "{0}" ({1}) cannot be converted \
+ into a filter listener.
+bad-setter-hint-arg: In query hint "{0}", cannot convert hint value "{1}" to \
+ type "{2}".
+detach-val-mismatch: The instance "{0}" is managed by another context and \
+ cannot be inspected for field values.
+detach-val-badsm: The instance "{0}" has an unknown state manager which \
+ prevents field inspection.
+null-oid: Cannot perform find using null object id.
+illegal-op-in-prestore: This operation is illegal when called during \
+ transaction completion.
+no-expressions: The query cannot be executed because it has no \
+ valid expressions.
+null-fg: Attempt to add null/empty fetch group name to fetch configuration.
+null-field: Attempt to add null/empty field name to fetch configuration.
+container-projection: Query projections cannot include array, collection, or \
+ map fields. Invalid query: "{0}"
+existing-value-override-excep: The generated value processing detected an \
+existing value assigned to this field: {0}. This existing value was either \
+provided via an initializer or by calling the setter method. You either need \
+to remove the @GeneratedValue annotation or modify the code to remove the \
+initializer processing.
+invalid-tran-status: The transaction was not in a valid state ({0}) to \
+accept the "{1}" method invocation. Processing will continue.
+multi-threaded-access: Multiple concurrent threads attempted to access a \
+ single broker. By default brokers are not thread safe; if you require \
+ and/or intend a broker to be accessed by more than one thread, set the \
+ openjpa.Multithreaded property to true to override the default behavior.
+no-saved-fields: No state snapshot is available for instance of type "{0}", \
+ but this instance uses state-comparison for dirty detection.
+cant-serialize-flushed-broker: Serialization not allowed once a broker has \
+ been flushed.
+cant-serialize-pessimistic-broker: Serialization not allowed for brokers with \
+ an active datastore (pessimistic) transaction.
+cant-serialize-connected-broker: Serialization not allowed for brokers with \
+ an active connection to the database.
+no-interface-metadata: No metadata was found for managed interface {0}.
+fetch-configuration-stack-empty: Fetch configuration stack is empty.
\ No newline at end of file
Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java Tue Aug 19 11:40:34 2008
@@ -26,7 +26,6 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.OptimisticLockException;
-import javax.persistence.Query;
import javax.persistence.TransactionRequiredException;
import org.apache.openjpa.jdbc.sql.DBDictionary;
@@ -159,38 +158,12 @@
}
/**
- * Invalid query throws IllegalArgumentException on construction
- * as per JPA spec.
- */
- public void testIllegalArgumennExceptionOnInvalidQuery() {
- EntityManager em = emf.createEntityManager();
- try {
- em.createQuery("This is not a valid JPQL query");
- fail("Did not throw IllegalArgumentException for invalid query.");
- } catch (Throwable t) {
- assertException(t, IllegalArgumentException.class);
- }
- }
-
- /**
- * Invalid named query fails as per spec on factory based construction.
- */
- public void testIllegalArgumennExceptionOnInvalidNamedQuery() {
- EntityManager em = emf.createEntityManager();
- try {
- Query query = em.createNamedQuery("This is invalid Named query");
- } catch (Throwable t) {
- assertException(t, IllegalArgumentException.class);
- }
- }
-
- /**
* Asserts that the given expected type of the exception is equal to or a
* subclass of the given throwable or any of its nested exception.
* Otherwise fails assertion and prints the given throwable and its nested
* exception on the console.
*/
- public void assertException(Throwable t, Class expectedType) {
+ void assertException(Throwable t, Class expectedType) {
if (!isExpectedException(t, expectedType)) {
t.printStackTrace();
print(t, 0);
Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/TestNonPrimaryKeyQueryParameters.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/TestNonPrimaryKeyQueryParameters.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/TestNonPrimaryKeyQueryParameters.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/query/cache/TestNonPrimaryKeyQueryParameters.java Tue Aug 19 11:40:34 2008
@@ -80,6 +80,7 @@
EntityManager em = emf.createEntityManager();
Query query = em.createQuery("SELECT d from Department d");
+ query.setParameter(1, DEPT_NAME);
Department dept = (Department) query.getSingleResult();
assertEquals(FULLTIME_EMPLOYEE_COUNT, dept.getFullTimeEmployees()
Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity.java Tue Aug 19 11:40:34 2008
@@ -33,11 +33,11 @@
import javax.persistence.SqlResultSetMapping;
import javax.persistence.Table;
-@NamedQuery(name="FindXTwo", query="select s from simple s where s.name = ?1")
+@NamedQuery(name="FindXTwo", query="select s from simple s where s.name = :fname")
@NamedQueries( {
- @NamedQuery(name="FindOne", query="select s from simple s where s.name = ?1"),
- @NamedQuery(name="FindOne", query="select s from simple s where s.name = ?1"),
+ @NamedQuery(name="FindOne", query="select s from simple s where s.name = :fname"),
+ @NamedQuery(name="FindOne", query="select s from simple s where s.name = :fname"),
@NamedQuery(name="FindAll", query="select s from simple s")
})
Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity2.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity2.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity2.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/SimpleEntity2.java Tue Aug 19 11:40:34 2008
@@ -27,11 +27,11 @@
import javax.persistence.NamedQuery;
import javax.persistence.Table;
-@NamedQuery(name="FindXTwo", query="select s from simple2 s where s.name = ?1")
+@NamedQuery(name="FindXTwo", query="select s from simple2 s where s.name = :fname")
@NamedQueries( {
- @NamedQuery(name="FindOne", query="select s from simple2 s where s.name = ?1"),
- @NamedQuery(name="Find2One", query="select s from simple2 s where s.name = ?1"),
+ @NamedQuery(name="FindOne", query="select s from simple2 s where s.name = :fname"),
+ @NamedQuery(name="Find2One", query="select s from simple2 s where s.name = :fname"),
@NamedQuery(name="Find2All", query="select s from simple2 s")
})
Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestDupNamedQuery.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestDupNamedQuery.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestDupNamedQuery.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestDupNamedQuery.java Tue Aug 19 11:40:34 2008
@@ -60,8 +60,8 @@
assertNotNull(list);
assertEquals(list.size(), 1);
Object o = list.get(0);
- assertTrue(simple2 ? o instanceof SimpleEntity2
- : o instanceof SimpleEntity);
+ assertSame(o.getClass(), simple2 ? SimpleEntity2.class
+ : SimpleEntity.class);
assertEquals(simple2 ? ((SimpleEntity2) o).getValue()
: ((SimpleEntity) o).getValue(), ValueOne);
@@ -71,8 +71,8 @@
assertEquals(list.size(), 2);
for (Iterator resultIter = list.iterator(); resultIter.hasNext();) {
o = resultIter.next();
- assertTrue(simple2 ? o instanceof SimpleEntity2
- : o instanceof SimpleEntity);
+ assertSame(o.getClass(), simple2 ? SimpleEntity2.class
+ : SimpleEntity.class);
String n = null;
String v = null;
if (simple2) {
Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java Tue Aug 19 11:40:34 2008
@@ -18,13 +18,7 @@
*/
package org.apache.openjpa.persistence.test;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.lang.reflect.Modifier;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -302,99 +296,4 @@
else if (o1.equals(o2))
fail("expected args to be different; compared equal.");
}
-
- /**
- * Round-trip a serializable object to bytes.
- */
- public static Object roundtrip(Object o)
- throws ClassNotFoundException, IOException {
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bytes);
- out.writeObject(o);
- out.flush();
- ObjectInputStream in = new ObjectInputStream(
- new ByteArrayInputStream(bytes.toByteArray()));
- return in.readObject();
- }
-
- // ================================================
- // Utility methods for exception handling
- // ================================================
- /**
- * Asserts that the given targetType is assignable from given actual
- * Throwable.
- */
- protected void assertException(final Throwable actual, Class targetType) {
- assertException(actual, targetType, null);
- }
-
- /**
- * Asserts that the given targetType is assignable from given actual
- * Throwable. Asserts that the nestedType is nested (possibly recursively)
- * within the given actual Throwable.
- *
- * @param actual is the actual throwable to be tested
- * @param targetType is expected type or super type of actual. If null, then
- * the check is omitted.
- * @param nestedTargetType is expected type of exception nested within
- * actual. If null this search is omitted.
- *
- */
- protected void assertException(final Throwable actual, Class targetType,
- Class nestedTargetType) {
- assertNotNull(actual);
- Class actualType = actual.getClass();
- if (targetType != null && !targetType.isAssignableFrom(actualType)) {
- actual.printStackTrace();
- fail(targetType.getName() + " is not assignable from "
- + actualType.getName());
- }
-
- if (nestedTargetType != null) {
- Throwable nested = actual.getCause();
- Class nestedActualType = (nested == null) ? null : nested.getClass();
- while (nestedActualType != null) {
- if (nestedTargetType.isAssignableFrom(nestedActualType)) {
- return;
- } else {
- Throwable next = nested.getCause();
- if (next == null || next == nested)
- break;
- nestedActualType = next.getClass();
- nested = next;
- }
- }
- actual.printStackTrace();
- fail("No nested type " + nestedTargetType + " in " + actual);
- }
- }
-
- /**
- * Assert that each of given keys are present in the message of the given
- * Throwable.
- */
- protected void assertMessage(Throwable actual, String... keys) {
- if (actual == null || keys == null)
- return;
- String message = actual.getMessage();
- for (String key : keys) {
- assertTrue(key + " is not in " + message, message.contains(key));
- }
- }
-
- public void printException(Throwable t) {
- printException(t, 2);
- }
-
- public void printException(Throwable t, int tab) {
- if (t == null) return;
- for (int i=0; i<tab*4;i++) System.out.print(" ");
- String sqlState = (t instanceof SQLException) ?
- "(SQLState=" + ((SQLException)t).getSQLState() + ":"
- + t.getMessage() + ")" : "";
- System.out.println(t.getClass().getName() + sqlState);
- if (t.getCause() == t)
- return;
- printException(t.getCause(), tab+2);
- }
}
Modified: openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java Tue Aug 19 11:40:34 2008
@@ -1582,17 +1582,14 @@
if (_log.isTraceEnabled())
_log.trace(_loc.get("parse-query", query.name()));
- meta = getRepository().searchQueryMetaDataByName(query.name());
+ meta = getRepository().getCachedQueryMetaData(null, query.name());
if (meta != null) {
- Class definingType = meta.getDefiningType();
- if ((definingType == null || definingType != _cls)
- && _log.isWarnEnabled()) {
- _log.warn(_loc.get("dup-query", query.name(), el,
- definingType));
- }
+ if (_log.isWarnEnabled())
+ _log.warn(_loc.get("dup-query", query.name(), el));
continue;
}
- meta = getRepository().addQueryMetaData(_cls, query.name());
+
+ meta = getRepository().addQueryMetaData(null, query.name());
meta.setQueryString(query.query());
meta.setLanguage(JPQLParser.LANG_JPQL);
for (QueryHint hint : query.hints())
@@ -1626,12 +1623,10 @@
if (_log.isTraceEnabled())
_log.trace(_loc.get("parse-native-query", query.name()));
- meta = getRepository().searchQueryMetaDataByName(query.name());
+ meta = getRepository().getCachedQueryMetaData(null, query.name());
if (meta != null) {
- Class defType = meta.getDefiningType();
- if ((defType != _cls) && _log.isWarnEnabled()) {
- _log.warn(_loc.get("dup-query", query.name(), el, defType));
- }
+ if (_log.isWarnEnabled())
+ _log.warn(_loc.get("dup-query", query.name(), el));
continue;
}
Modified: openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=687120&r1=687119&r2=687120&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java (original)
+++ openjpa/branches/1.2.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java Tue Aug 19 11:40:34 2008
@@ -87,7 +87,7 @@
private Map<FetchConfiguration,FetchPlan> _plans =
new IdentityHashMap<FetchConfiguration,FetchPlan>(1);
- private RuntimeExceptionTranslator _ret =
+ private RuntimeExceptionTranslator ret =
PersistenceExceptions.getRollbackTranslator(this);
public EntityManagerImpl() {
@@ -104,8 +104,8 @@
private void initialize(EntityManagerFactoryImpl factory, Broker broker) {
_emf = factory;
- _broker = new DelegatingBroker(broker, _ret);
- _broker.setImplicitBehavior(this, _ret);
+ _broker = new DelegatingBroker(broker, ret);
+ _broker.setImplicitBehavior(this, ret);
}
/**
@@ -867,16 +867,7 @@
public OpenJPAQuery createQuery(String language, String query) {
assertNotCloseInvoked();
- try {
- org.apache.openjpa.kernel.Query q = _broker.newQuery(language,
- query);
- // have to validate JPQL according to spec
- if (JPQLParser.LANG_JPQL.equals(language))
- q.compile();
- return new QueryImpl(this, _ret, q);
- } catch (RuntimeException re) {
- throw PersistenceExceptions.toPersistenceException(re);
- }
+ return new QueryImpl(this, ret, _broker.newQuery(language, query));
}
public OpenJPAQuery createQuery(Query query) {
@@ -884,7 +875,7 @@
return createQuery((String) null);
assertNotCloseInvoked();
org.apache.openjpa.kernel.Query q = ((QueryImpl) query).getDelegate();
- return new QueryImpl(this, _ret, _broker.newQuery(q.getLanguage(),
+ return new QueryImpl(this, ret, _broker.newQuery(q.getLanguage(),
q));
}
@@ -900,7 +891,7 @@
meta.setInto(del);
del.compile();
- OpenJPAQuery q = new QueryImpl(this, _ret, del);
+ OpenJPAQuery q = new QueryImpl(this, ret, del);
String[] hints = meta.getHintKeys();
Object[] values = meta.getHintValues();
for (int i = 0; i < hints.length; i++)
@@ -926,7 +917,7 @@
org.apache.openjpa.kernel.Query kernelQuery = _broker.newQuery(
QueryLanguages.LANG_SQL, query);
kernelQuery.setResultMapping(null, mappingName);
- return new QueryImpl(this, _ret, kernelQuery);
+ return new QueryImpl(this, ret, kernelQuery);
}
/**
@@ -1244,7 +1235,7 @@
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
try {
- _ret = PersistenceExceptions.getRollbackTranslator(this);
+ ret = PersistenceExceptions.getRollbackTranslator(this);
// this assumes that serialized Brokers are from something
// that extends AbstractBrokerFactory.
@@ -1263,7 +1254,7 @@
initialize(emf, broker);
} catch (RuntimeException re) {
try {
- re = _ret.translate(re);
+ re = ret.translate(re);
} catch (Exception e) {
// ignore
}
@@ -1285,7 +1276,7 @@
out.writeObject(baos.toByteArray());
} catch (RuntimeException re) {
try {
- re = _ret.translate(re);
+ re = ret.translate(re);
} catch (Exception e) {
// ignore
}