aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Kraus2014-03-24 05:55:19 (EDT)
committerGordon Yorke2014-03-27 10:00:45 (EDT)
commitc62e90a1365d2054f5b247ac04f93fee12062f7f (patch)
tree2e9be97341125492da7516094e8687dbc591c2c9
parentbd2042aeb72b8a52bb261cd606c7382f57937a4e (diff)
downloadeclipselink.runtime-c62e90a1365d2054f5b247ac04f93fee12062f7f.zip
eclipselink.runtime-c62e90a1365d2054f5b247ac04f93fee12062f7f.tar.gz
eclipselink.runtime-c62e90a1365d2054f5b247ac04f93fee12062f7f.tar.bz2
Bug# 407834 - Added missing checks and field updates from org.eclipse.persistence.internal.jpa.metadata.ORMetadata#setFieldName Now field name case sensitivity is the same in mapping and CacheIndex. Signed-off-by: Tomas Kraus <tomas.kraus@oracle.com>
-rw-r--r--jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/Buyer.java7
-rw-r--r--jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/cache/CacheIndexMetadata.java13
2 files changed, 15 insertions, 5 deletions
diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/Buyer.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/Buyer.java
index 18c6d90..2058b56 100644
--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/Buyer.java
+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/advanced/Buyer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -211,8 +211,9 @@ public class Buyer implements Serializable {
public Integer getId() {
return id;
}
-
- @Column(name="BUYER_NAME")
+
+ // Use lower case column name to trigger bug# 407834 issue
+ @Column(name="buyer_name")
@CacheIndex
public String getName() {
return name;
diff --git a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/cache/CacheIndexMetadata.java b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/cache/CacheIndexMetadata.java
index d8d3122..fcd4777 100644
--- a/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/cache/CacheIndexMetadata.java
+++ b/jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metadata/cache/CacheIndexMetadata.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -18,6 +18,8 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.persistence.descriptors.CacheIndex;
+import org.eclipse.persistence.descriptors.CachePolicy;
+import org.eclipse.persistence.internal.helper.DatabaseField;
import org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor;
import org.eclipse.persistence.internal.jpa.metadata.ORMetadata;
import org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor;
@@ -105,7 +107,14 @@ public class CacheIndexMetadata extends ORMetadata {
*/
public void process(MetadataDescriptor descriptor, String defaultColumnName) {
if (m_columnNames.isEmpty() && (defaultColumnName != null)) {
- descriptor.getClassDescriptor().getCachePolicy().addCacheIndex(defaultColumnName);
+ CachePolicy cachePolicy = descriptor.getClassDescriptor().getCachePolicy();
+ DatabaseField field = new DatabaseField(defaultColumnName);
+ if (m_project.useDelimitedIdentifier()) {
+ field.setUseDelimiters(true);
+ } else if (m_project.getShouldForceFieldNamesToUpperCase() && !field.shouldUseDelimiters()) {
+ field.useUpperCaseForComparisons(true);
+ }
+ cachePolicy.addCacheIndex(new DatabaseField[] {field});
} else {
CacheIndex index = new CacheIndex();
if (this.updateable != null) {