245431 - Add cache default property to persistence.xml.  Patch from Les.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
index b369b94..7742212 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
@@ -129,6 +129,21 @@
 		return this.caching;
 	}
 
+	public String getDefaultCacheTypePropertyValue() {
+		Property cacheTypeDefaultProperty = getCacheTypeDefaultProperty();
+		return cacheTypeDefaultProperty != null ? cacheTypeDefaultProperty.getValue() : null;
+	}
+	
+	public String getDefaultCacheSizePropertyValue() {
+		Property cacheSizeDefaultProperty = getCacheSizeDefaultProperty();
+		return cacheSizeDefaultProperty != null ? cacheSizeDefaultProperty.getValue() : null;
+	}
+	
+	public String getDefaultCacheSharedPropertyValue() {
+		Property cacheSharedDefaultProperty = getCacheSharedDefaultProperty();
+		return cacheSharedDefaultProperty != null ? cacheSharedDefaultProperty.getValue() : null;
+	}
+	
 	public Logging getLogging() {
 		return this.logging;
 	}
@@ -141,7 +156,7 @@
 	public SchemaGeneration getSchemaGeneration() {
 		return this.schemaGeneration;
 	}
-
+	
 	protected GeneralProperties buildEclipseLinkGeneralProperties() {
 		return new EclipseLinkGeneralProperties(this);
 	}
@@ -828,6 +843,10 @@
 	private Property getCacheSizeDefaultProperty() {
 		return this.getProperty(Caching.ECLIPSELINK_CACHE_SIZE_DEFAULT);
 	}
+	
+	private Property getCacheSharedDefaultProperty() {
+		return this.getProperty(Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT);
+	}
 
 	private Property getFlushClearCacheProperty() {
 		return this.getProperty(Caching.ECLIPSELINK_FLUSH_CLEAR_CACHE);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java
index 8996a90..d60aba0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java
@@ -10,8 +10,10 @@
 package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java;
 
 import java.util.List;
+
 import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
 import org.eclipse.jpt.jpa.core.context.PersistentType;
 import org.eclipse.jpt.jpa.core.context.TypeMapping;
 import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -28,6 +30,7 @@
 import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay;
 import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching;
 import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
 import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
 import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
 import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation;
@@ -146,10 +149,17 @@
 	}
 
 	public EclipseLinkCacheType getDefaultType() {
+		String puDefaultCacheTypeName = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheTypePropertyValue();
+		if (!StringTools.stringIsEmpty(puDefaultCacheTypeName)) {
+			try { 
+				return EclipseLinkCacheType.valueOf(StringTools.convertCamelCaseToAllCaps(puDefaultCacheTypeName));
+			} catch (IllegalArgumentException exception) {
+				//no match, return default
+			}
+		}
 		return DEFAULT_TYPE;
 	}
-
-
+	
 	// ********** size **********
 
 	public int getSize() {
@@ -176,6 +186,14 @@
 	}
 
 	public int getDefaultSize() {
+		String puDefaultCacheSize = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSizePropertyValue();
+		if (!StringTools.stringIsEmpty(puDefaultCacheSize)) {
+			try {
+				return Integer.valueOf(puDefaultCacheSize).intValue();
+			} catch (NumberFormatException exception) {
+				//couldn't parse, return default
+			}
+		}
 		return DEFAULT_SIZE;
 	}
 
@@ -213,7 +231,8 @@
 	}
 
 	public boolean isDefaultShared() {
-		return DEFAULT_SHARED;
+		String puDefaultSharedCache = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSharedPropertyValue();
+		return !StringTools.stringIsEmpty(puDefaultSharedCache) ? Boolean.valueOf(puDefaultSharedCache) : DEFAULT_SHARED;
 	}
 
 
@@ -573,7 +592,6 @@
 		return this.getTypeMapping().getResourcePersistentType();
 	}
 
-
 	// ********** validation **********
 
 	@Override
@@ -581,7 +599,7 @@
 		super.validate(messages, reporter, astRoot);
 		this.validateExpiry(messages, astRoot);
 	}
-
+	
 	protected void validateExpiry(List<IMessage> messages, CompilationUnit astRoot) {
 		if ((this.expiry != null) && (this.expiryTimeOfDay != null)) {
 			messages.add(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java
index 5091199..c2be3d6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java
@@ -10,6 +10,7 @@
 package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
 
 import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
 import org.eclipse.jpt.jpa.core.context.PersistentType;
 import org.eclipse.jpt.jpa.core.context.TypeMapping;
 import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -29,6 +30,7 @@
 import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkNonEmbeddableTypeMapping;
 import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkCaching;
 import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkNonEmbeddableTypeMapping;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
 import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
 import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlCache;
 import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlCacheHolder;
@@ -176,6 +178,14 @@
 	}
 
 	public EclipseLinkCacheType getDefaultType() {
+		String puDefaultCacheTypeName = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheTypePropertyValue();
+		if (!StringTools.stringIsEmpty(puDefaultCacheTypeName)) {
+			try { 
+				return EclipseLinkCacheType.valueOf(StringTools.convertCamelCaseToAllCaps(puDefaultCacheTypeName));
+			} catch (IllegalArgumentException exception) {
+				//no match, return default
+			}
+		}
 		return this.defaultType;
 	}
 
@@ -221,6 +231,14 @@
 	}
 
 	public int getDefaultSize() {
+		String puDefaultCacheSize = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSizePropertyValue();
+		if (!StringTools.stringIsEmpty(puDefaultCacheSize)) {
+			try {
+				return Integer.valueOf(puDefaultCacheSize).intValue();
+			} catch (NumberFormatException exception) {
+				//couldn't parse, return default
+			}
+		}
 		return this.defaultSize;
 	}
 
@@ -273,7 +291,8 @@
 	}
 
 	public boolean isDefaultShared() {
-		return this.defaultShared;
+		String puDefaultSharedCache = ((EclipseLinkPersistenceUnit)getPersistenceUnit()).getDefaultCacheSharedPropertyValue();
+		return !StringTools.stringIsEmpty(puDefaultSharedCache) ? Boolean.valueOf(puDefaultSharedCache) : this.defaultShared;
 	}
 
 	protected void setDefaultShared(boolean shared) {
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java
index 9f44676..e27fe69 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java
@@ -20,6 +20,7 @@
 import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay;
 import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching;
 import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEntity;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching;
 import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink;
 import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkCacheAnnotation;
 import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkExistenceCheckingAnnotation;
@@ -114,6 +115,20 @@
 		assertNull(cacheAnnotation.getExpiryTimeOfDay());
 	}
 	
+	public void testGetDefaultShared() throws Exception {
+		createTestEntity();
+		addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+		
+		JavaEclipseLinkEntity entity = (JavaEclipseLinkEntity) getJavaPersistentType().getMapping();
+		JavaEclipseLinkCaching caching = entity.getCaching();
+		
+		assertTrue(caching.isDefaultShared());
+		
+		getPersistenceUnit().setProperty(Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT, "false");
+		
+		assertFalse(caching.isDefaultShared());
+	}
+	
 	public void testGetSpecifiedShared() throws Exception {
 		createTestEntity();
 		addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
@@ -165,6 +180,20 @@
 		assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getType());
 	}
 	
+	public void testGetDefaultType() throws Exception {
+		createTestEntity();
+		addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+		
+		JavaEclipseLinkEntity entity = (JavaEclipseLinkEntity) getJavaPersistentType().getMapping();
+		JavaEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getDefaultType());
+		
+		getPersistenceUnit().setProperty(Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT, EclipseLinkCacheType.FULL.toString());
+		
+		assertEquals(EclipseLinkCacheType.FULL, caching.getDefaultType());
+	}
+	
 	public void testGetSpecifiedType() throws Exception {
 		createTestEntity();
 		addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
@@ -624,6 +653,20 @@
 		assertEquals(new Integer(50), cacheAnnotation.getSize());		
 	}
 	
+	public void testGetDefaultSize() throws Exception {
+		createTestEntity();
+		addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+		
+		JavaEclipseLinkEntity entity = (JavaEclipseLinkEntity) getJavaPersistentType().getMapping();
+		JavaEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(100, caching.getDefaultSize());
+		
+		getPersistenceUnit().setProperty(Caching.ECLIPSELINK_CACHE_SIZE_DEFAULT, "333");
+		
+		assertEquals(333, caching.getDefaultSize());
+	}
+	
 	public void testGetSpecifiedSize() throws Exception {
 		createTestEntity();
 		addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmCachingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmCachingTests.java
new file mode 100644
index 0000000..6da84e5
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmCachingTests.java
@@ -0,0 +1,424 @@
+package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.orm;
+
+import java.util.Iterator;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheCoordinationType;
+import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCacheType;
+import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkExistenceType;
+import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTimeOfDay;
+import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkCaching;
+import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkEntity;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching;
+
+public class EclipseLinkOrmCachingTests extends EclipseLinkOrmContextModelTestCase {
+
+	private ICompilationUnit createTestEntity() throws Exception {
+		return this.createTestType(new DefaultAnnotationWriter() {
+			@Override
+			public Iterator<String> imports() {
+				return new ArrayIterator<String>(JPA.ENTITY);
+			}
+			@Override
+			public void appendTypeAnnotationTo(StringBuilder sb) {
+				sb.append("@Entity").append(CR);
+			}
+		});
+	}
+	
+	public EclipseLinkOrmCachingTests(String name) {
+		super(name);
+	}
+	
+	public void testSetSpecifiedShared() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(true, caching.isShared());
+		
+		caching.setSpecifiedShared(Boolean.FALSE);
+		
+		
+		assertEquals(Boolean.FALSE, entity.getCaching().getSpecifiedShared());
+		assertEquals(false, entity.getCaching().isShared());
+		
+		
+	}
+
+	public void testSetSpecifiedSharedFalseUnsetsOtherCacheSettings() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		caching.setSpecifiedType(EclipseLinkCacheType.HARD_WEAK);
+		caching.setSpecifiedSize(Integer.valueOf(500));
+		caching.setSpecifiedAlwaysRefresh(Boolean.FALSE);
+		caching.setSpecifiedRefreshOnlyIfNewer(Boolean.FALSE);
+		caching.setSpecifiedDisableHits(Boolean.FALSE);
+		caching.setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
+		caching.setSpecifiedExistenceType(EclipseLinkExistenceType.CHECK_CACHE);
+		caching.setExpiry(Integer.valueOf(8000));
+		
+		caching.setSpecifiedShared(Boolean.FALSE);
+		
+		assertEquals(null, caching.getSpecifiedType());
+		assertEquals(null, caching.getSpecifiedSize());
+		assertEquals(null, caching.getSpecifiedAlwaysRefresh());
+		assertEquals(null, caching.getSpecifiedRefreshOnlyIfNewer());
+		assertEquals(null, caching.getSpecifiedDisableHits());
+		assertEquals(null, caching.getSpecifiedCoordinationType());
+		assertEquals(null, caching.getExpiry());
+		
+		
+		//existence checking is the only thing that isn't unset when shared is set to false
+		assertEquals(EclipseLinkExistenceType.CHECK_CACHE, caching.getSpecifiedExistenceType());
+		
+		caching.setSpecifiedShared(null);
+		EclipseLinkTimeOfDay timeOfDayExpiry = caching.addExpiryTimeOfDay();
+		timeOfDayExpiry.setHour(Integer.valueOf(5));
+		
+		caching.setSpecifiedShared(Boolean.FALSE);
+		assertNull(caching.getExpiryTimeOfDay());
+		
+	}
+
+	public void testGetDefaultShared() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertTrue(caching.isDefaultShared());
+		
+		getPersistenceUnit().setProperty(Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT, "false");
+		
+		assertFalse(caching.isDefaultShared());
+	}
+	
+	public void testGetSpecifiedShared() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(true, caching.isShared());
+		
+	}
+	
+	public void testSetSpecifiedType() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getType());
+		
+		caching.setSpecifiedType(EclipseLinkCacheType.HARD_WEAK);
+		
+		
+		assertEquals(EclipseLinkCacheType.HARD_WEAK, entity.getCaching().getSpecifiedType());
+		assertEquals(EclipseLinkCacheType.HARD_WEAK, entity.getCaching().getType());
+		
+		caching.setSpecifiedType(EclipseLinkCacheType.SOFT_WEAK);
+		assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getSpecifiedType());
+		
+		caching.setSpecifiedType(null);
+		assertNull(caching.getSpecifiedType());
+		assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getType());
+	}
+	
+	public void testGetDefaultType() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getDefaultType());
+		
+		getPersistenceUnit().setProperty(Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT, EclipseLinkCacheType.FULL.toString());
+		
+		assertEquals(EclipseLinkCacheType.FULL, caching.getDefaultType());
+	}
+
+	public void testGetSpecifiedType() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(EclipseLinkCacheType.SOFT_WEAK, caching.getType());
+		
+	}
+
+	public void testSetSpecifiedAlwaysRefresh() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(false, caching.isAlwaysRefresh());
+		
+		caching.setSpecifiedAlwaysRefresh(Boolean.FALSE);
+		
+		
+		assertEquals(Boolean.FALSE, entity.getCaching().getSpecifiedAlwaysRefresh());
+		assertEquals(false, entity.getCaching().isAlwaysRefresh());
+		
+	}
+	
+	public void testGetSpecifiedAlwaysRefresh() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(false, caching.isAlwaysRefresh());
+		
+	}
+	
+	public void testSetSpecifiedRefreshOnlyIfNewer() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(false, caching.isRefreshOnlyIfNewer());
+		
+		caching.setSpecifiedRefreshOnlyIfNewer(Boolean.TRUE);
+		
+		
+		assertEquals(Boolean.TRUE, entity.getCaching().getSpecifiedRefreshOnlyIfNewer());
+		assertEquals(true, entity.getCaching().isRefreshOnlyIfNewer());
+		
+	}
+	
+	public void testGetSpecifiedRefreshOnlyIfNewer() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(false, caching.isRefreshOnlyIfNewer());
+		
+	}
+
+	public void testSetSpecifiedDisableHits() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(false, caching.isDisableHits());
+		
+		caching.setSpecifiedDisableHits(Boolean.TRUE);
+		
+		
+		assertEquals(Boolean.TRUE, entity.getCaching().getSpecifiedDisableHits());
+		assertEquals(true, entity.getCaching().isDisableHits());
+		
+	}
+	
+	public void testGetSpecifiedDisableHits() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(false, caching.isDisableHits());
+		
+	}
+
+	public void testSetSpecifiedCoordinationType() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(EclipseLinkCacheCoordinationType.SEND_OBJECT_CHANGES, caching.getCoordinationType());
+		
+		caching.setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType.INVALIDATE_CHANGED_OBJECTS);
+		
+		
+		assertEquals(EclipseLinkCacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, entity.getCaching().getSpecifiedCoordinationType());
+		assertEquals(EclipseLinkCacheCoordinationType.INVALIDATE_CHANGED_OBJECTS, entity.getCaching().getCoordinationType());
+			
+		//set specified coordination type to the same as the default, verify it is not set to default
+		caching.setSpecifiedCoordinationType(EclipseLinkCacheCoordinationType.SEND_OBJECT_CHANGES);
+		assertEquals(EclipseLinkCacheCoordinationType.SEND_OBJECT_CHANGES, caching.getSpecifiedCoordinationType());
+		
+		caching.setSpecifiedCoordinationType(null);
+		assertNull(caching.getSpecifiedCoordinationType());
+		assertEquals(EclipseLinkCacheCoordinationType.SEND_OBJECT_CHANGES, caching.getCoordinationType());
+	}
+	
+	public void testGetSpecifiedCoordinationType() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(EclipseLinkCacheCoordinationType.SEND_OBJECT_CHANGES, caching.getCoordinationType());
+	}
+	
+	public void testGetExpiry() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		
+		assertNull(entity.getCaching().getExpiry());
+		
+	}
+	
+	public void testSetExpiry() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		caching.setExpiry(Integer.valueOf(58));
+		assertEquals(Integer.valueOf(58), caching.getExpiry());
+		
+		
+		caching.setExpiry(null);
+		assertNull(caching.getExpiry());
+	}
+	
+	public void testSetExpiryUnsetsExpiryTimeOfDay() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		caching.addExpiryTimeOfDay();
+		caching.getExpiryTimeOfDay().setHour(Integer.valueOf(5));
+		assertEquals(Integer.valueOf(5), caching.getExpiryTimeOfDay().getHour());
+		
+		caching.setExpiry(Integer.valueOf(900));
+		
+		assertNull(caching.getExpiryTimeOfDay());
+		assertEquals(Integer.valueOf(900), caching.getExpiry());	
+	}
+	
+	public void testGetTimeOfDayExpiry() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertNull(caching.getExpiryTimeOfDay());
+	}
+	
+	public void testAddTimeOfDayExpiry() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertNull(caching.getExpiryTimeOfDay());
+		
+		EclipseLinkTimeOfDay timeOfDayExpiry = caching.addExpiryTimeOfDay();
+		
+		assertNotNull(caching.getExpiryTimeOfDay());
+		assertEquals(timeOfDayExpiry, caching.getExpiryTimeOfDay());
+	}
+	
+	public void testRemoveTimeOfDayExpiry() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertNull(caching.getExpiryTimeOfDay());
+	}
+	
+	public void testAddTimeOfDayExpiryUnsetsExpiry() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		caching.setExpiry(Integer.valueOf(800));
+		assertEquals(Integer.valueOf(800), caching.getExpiry());	
+		
+		caching.addExpiryTimeOfDay();
+		
+		assertNull(caching.getExpiry());
+		assertNotNull(caching.getExpiryTimeOfDay());
+	}
+
+	
+	public void testSetSpecifiedSize() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(100, caching.getSize());
+		
+		caching.setSpecifiedSize(new Integer(50));
+		
+		
+		assertEquals(new Integer(50), entity.getCaching().getSpecifiedSize());
+		assertEquals(50, entity.getCaching().getSize());
+	}
+	
+	public void testGetDefaultSize() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(100, caching.getDefaultSize());
+		
+		getPersistenceUnit().setProperty(Caching.ECLIPSELINK_CACHE_SIZE_DEFAULT, "333");
+		
+		assertEquals(333, caching.getDefaultSize());
+	}
+	
+	public void testGetSpecifiedSize() throws Exception {
+		createTestEntity();
+		
+		OrmPersistentType type = (OrmPersistentType)getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+		OrmEclipseLinkEntity entity = (OrmEclipseLinkEntity)type.getMapping();
+		OrmEclipseLinkCaching caching = entity.getCaching();
+		
+		assertEquals(100, caching.getSize());
+		
+		caching.setSpecifiedSize(new Integer(50));
+		getJpaProject().synchronizeContextModel();
+		
+		assertEquals(new Integer(50), entity.getCaching().getSpecifiedSize());
+		assertEquals(50, entity.getCaching().getSize());
+	}
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java
index 95ba5bd..2ddd020 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java
@@ -37,6 +37,7 @@
 		suite.addTestSuite(EclipseLinkOrmObjectTypeConverterTests.class);
 		suite.addTestSuite(EclipseLinkOrmStructConverterTests.class);
 		suite.addTestSuite(EclipseLinkOrmTypeConverterTests.class);
+		suite.addTestSuite(EclipseLinkOrmCachingTests.class);
 		return suite;
 	}