Author: allee8285
Date: Wed Aug 8 18:02:44 2012
New Revision: 1370866
URL: http://svn.apache.org/viewvc?rev=1370866&view=rev
Log:
OPENJPA-428 - Remove Id property from remaining map in Configurations
Added:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Issue428Entity.java
(with props)
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenjpaIdNotRecognizedMessage.java
(with props)
Modified:
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Modified:
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java?rev=1370866&r1=1370865&r2=1370866&view=diff
==============================================================================
---
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
(original)
+++
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
Wed Aug 8 18:02:44 2012
@@ -665,6 +665,7 @@ public class ConfigurationImpl
// <prefix>.properties System property; remove that property so we
// we don't warn about it
Configurations.removeProperty("properties", remaining);
+ Configurations.removeProperty("Id", remaining, map);
// now warn if there are any remaining properties that there
// is an unhandled prop, and remove the unknown properties
Modified:
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java?rev=1370866&r1=1370865&r2=1370866&view=diff
==============================================================================
---
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
(original)
+++
openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Wed Aug 8 18:02:44 2012
@@ -693,10 +693,16 @@ public class Configurations {
public static Object removeProperty(String partialKey, Map props) {
if (partialKey == null || props == null || props.isEmpty())
return null;
- if (containsProperty(partialKey, props))
- return
props.remove(ProductDerivations.getConfigurationKey(partialKey, props));
- else
- return null;
+ if (containsProperty(partialKey, props))
+ return
props.remove(ProductDerivations.getConfigurationKey(partialKey, props));
+ else
+ return null;
+ }
+
+ public static void removeProperty(String partialKey, Map<?,?> remaining,
Map<?,?> props) {
+ if (removeProperty(partialKey, remaining) != null) {
+ removeProperty(partialKey, props);
+ }
}
/**
Added:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Issue428Entity.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Issue428Entity.java?rev=1370866&view=auto
==============================================================================
---
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Issue428Entity.java
(added)
+++
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Issue428Entity.java
Wed Aug 8 18:02:44 2012
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+package org.apache.openjpa.persistence;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "ISSUE_428_ENTITY")
+public class Issue428Entity {
+ protected double doubleField;
+
+ public Issue428Entity() {
+
+ }
+
+ public Issue428Entity(double df) {
+ doubleField = df;
+ }
+
+ public double getDoubleField() {
+ return doubleField;
+ }
+
+ public void setDoubleField(double doubleField) {
+ this.doubleField = doubleField;
+ }
+}
Propchange:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/Issue428Entity.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenjpaIdNotRecognizedMessage.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenjpaIdNotRecognizedMessage.java?rev=1370866&view=auto
==============================================================================
---
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenjpaIdNotRecognizedMessage.java
(added)
+++
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenjpaIdNotRecognizedMessage.java
Wed Aug 8 18:02:44 2012
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+package org.apache.openjpa.persistence;
+
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+public class TestOpenjpaIdNotRecognizedMessage extends SingleEMFTestCase {
+
+ public void setUp() {
+ super.setUp(CLEAR_TABLES, Issue428Entity.class);
+ }
+
+ /**
+ * Test to illustrate the existing '"openjpa.Id" was not recognized'
message in the trace,
+ * using Issue428Entity which does not have an annotated @Id field.
+ */
+ public void test428() {
+ emf.createEntityManager().close();
+ }
+}
Propchange:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenjpaIdNotRecognizedMessage.java
------------------------------------------------------------------------------
svn:eol-style = native