diff --git a/src/main/java/com/avaje/ebean/PersistenceContextScope.java b/src/main/java/com/avaje/ebean/PersistenceContextScope.java
index 37ebefe08..d3389a2e0 100644
--- a/src/main/java/com/avaje/ebean/PersistenceContextScope.java
+++ b/src/main/java/com/avaje/ebean/PersistenceContextScope.java
@@ -31,22 +31,5 @@ public enum PersistenceContextScope {
*
* You may use QUERY scope on a query that is executed in a transaction and you want to get a 'fresh copy' of the bean.
*/
- QUERY,
-
- /**
- * EXPERIMENTAL FEATURE - This is not expected to be used and somewhat experimental.
- * This NONE option effectively means that a PersistenceContext is not used when building the object graph and
- * subsequent lazy loading.
- *
- * You should ONLY use this when treating the resulting object graph as read only and even then you would be best
- * to use QUERY (or TRANSACTION).
- *
- * A query executed with NONE can build a object graph where there are multiple instances that represent the same
- * 'logical bean' by type and Id value (multiple instances of 'Customer 42'). Getting multiple instances that
- * represent the same logical bean (same row in the database) means that it is potentially dangerous/confusing to
- * use this scope when modifying the beans as multiple instances represent the same underlying rows in the database.
- *
- * Generally you would expect to always use TRANSACTION or QUERY scope.
- */
- NONE
+ QUERY
}
diff --git a/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java b/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java
index ac7c474f9..e57640695 100644
--- a/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java
+++ b/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java
@@ -198,18 +198,7 @@ public final class OrmQueryRequest extends BeanRequest implements BeanQueryRe
// determine the scope (from the query and then server)
PersistenceContextScope scope = ebeanServer.getPersistenceContextScope(query);
- switch (scope) {
- case QUERY:
- // Create a new PersistenceContext for this query
- return new DefaultPersistenceContext();
- case NONE:
- // Effectively don't use a PersistenceContext
- return new NoopPersistenceContext();
- default: {
- // Use the transaction scoped PersistenceContext
- return t.getPersistenceContext();
- }
- }
+ return (scope == PersistenceContextScope.QUERY) ? new DefaultPersistenceContext() : t.getPersistenceContext();
}
/**
diff --git a/src/test/java/com/avaje/tests/persistencecontext/TestPersistenceContextQueryScope.java b/src/test/java/com/avaje/tests/persistencecontext/TestPersistenceContextQueryScope.java
index 325127d2e..e91d5439b 100644
--- a/src/test/java/com/avaje/tests/persistencecontext/TestPersistenceContextQueryScope.java
+++ b/src/test/java/com/avaje/tests/persistencecontext/TestPersistenceContextQueryScope.java
@@ -48,15 +48,6 @@ public class TestPersistenceContextQueryScope extends BaseTestCase {
.setPersistenceContextScope(QUERY)
.findUnique();
- // NONE scope also hits the DB
- // ... also explicitly not use bean cache
- EBasicVer bean4 = Ebean.find(EBasicVer.class)
- .setId(bean.getId())
- .setUseCache(false) // ignore L2 cache
- .setPersistenceContextScope(NONE)
- .findUnique();
-
-
// TRANsACTION scope ... same as bean2 and does not hit the DB
EBasicVer bean5 = Ebean.find(EBasicVer.class)
.setId(bean.getId())
@@ -72,9 +63,7 @@ public class TestPersistenceContextQueryScope extends BaseTestCase {
assertSame(bean1, bean5);
assertEquals("second", bean3.getName());
- assertEquals("second", bean4.getName());
-
- Ebean.delete(bean4);
+ Ebean.delete(bean3);
Ebean.commitTransaction();
diff --git a/src/test/java/com/avaje/tests/persistencecontext/TestPersistencContextNone.java b/src/test/java/com/avaje/tests/persistencecontext/TestPersistenceContextScopeUsingOrders.java
similarity index 57%
rename from src/test/java/com/avaje/tests/persistencecontext/TestPersistencContextNone.java
rename to src/test/java/com/avaje/tests/persistencecontext/TestPersistenceContextScopeUsingOrders.java
index 4da92ff7b..f5a43e345 100644
--- a/src/test/java/com/avaje/tests/persistencecontext/TestPersistencContextNone.java
+++ b/src/test/java/com/avaje/tests/persistencecontext/TestPersistenceContextScopeUsingOrders.java
@@ -13,40 +13,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import static com.avaje.ebean.PersistenceContextScope.QUERY;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-public class TestPersistencContextNone extends BaseTestCase {
-
- @Test
- public void test_persistenceContextScopeNone() {
-
- ResetBasicData.reset();
-
-
- List orders = Ebean.find(Order.class)
- .setPersistenceContextScope(PersistenceContextScope.NONE)
- .fetch("customer", "id, name")
- .where().istartsWith("customer.name", "rob").eq("customer.id", 1)
- .orderBy().asc("customer.name")
- .findList();
-
- assertTrue(!orders.isEmpty());
-
- // collect the customer instances
- List customers = new ArrayList();
- Set identities = new HashSet();
-
- for (Order order : orders) {
- Customer customer = order.getCustomer();
- identities.add(System.identityHashCode(customer));
- customers.add(customer);
- }
-
- // Many instances of 'logically the same Customer'
- assertTrue(identities.size() > 1);
- assertEquals(identities.size(), customers.size());
- }
+public class TestPersistenceContextScopeUsingOrders extends BaseTestCase {
@Test
public void test_persistenceContextScopeQuery() {
@@ -55,7 +26,7 @@ public class TestPersistencContextNone extends BaseTestCase {
List orders = Ebean.find(Order.class)
// Use QUERY or TRANSACTION scope (just not NONE)
- .setPersistenceContextScope(PersistenceContextScope.QUERY)
+ .setPersistenceContextScope(QUERY)
.fetch("customer", "id, name")
.where().istartsWith("customer.name", "rob").eq("customer.id", 1)
.orderBy().asc("customer.name")