mirror of https://github.com/apache/openjpa.git
Reverting revisions 930357 and 930378 (except for the line ending changes). These changes were premature.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.1.x@965591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2516f52291
commit
3597aff75e
|
@ -1387,7 +1387,7 @@ public abstract class CacheTest extends AbstractTestCase {
|
|||
CacheObjectA a = (CacheObjectA) c.iterator().next();
|
||||
if (related)
|
||||
a.getRelatedArray();
|
||||
em.detachCopy(a);
|
||||
em.detach(a);
|
||||
assertEquals(ORIG_NAME, a.getName());
|
||||
q.closeAll();
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class TestCalendarFields extends BaseKernelTest {
|
|||
pm = getPM();
|
||||
c2 = (CalendarFields) pm.find(CalendarFields.class, id2);
|
||||
assertTimeZonesEquals(c1, c2);
|
||||
assertTimeZonesEquals(c1, (CalendarFields) pm.detachCopy(c2));
|
||||
assertTimeZonesEquals(c1, (CalendarFields) pm.detach(c2));
|
||||
endEm(pm);
|
||||
}
|
||||
|
||||
|
|
|
@ -531,7 +531,7 @@ public class TestDependentFields2 extends BaseKernelTest {
|
|||
assertEquals(2, owner.getDependentMappedList().size());
|
||||
else
|
||||
assertEquals(2, owner.getDependentInverseKeyList().size());
|
||||
DependentFieldsPC detached = (DependentFieldsPC) pm.detachCopy(owner);
|
||||
DependentFieldsPC detached = (DependentFieldsPC) pm.detach(owner);
|
||||
endEm(pm);
|
||||
|
||||
if (mapped) {
|
||||
|
|
|
@ -104,7 +104,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
|
||||
assertNotNull("b is null in testDetach", b);
|
||||
|
||||
b = (AttachB) pm.detachCopy(b);
|
||||
b = (AttachB) pm.detach(b);
|
||||
endEm(pm);
|
||||
|
||||
assertTrue(pm.isDetached(b));
|
||||
|
@ -147,7 +147,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
|
||||
assertNotNull("b is null in testDetachWithGroups", b);
|
||||
|
||||
b = (AttachB) pm.detachCopy(b);
|
||||
b = (AttachB) pm.detach(b);
|
||||
endEm(pm);
|
||||
|
||||
assertTrue(pm.isDetached(b));
|
||||
|
@ -186,7 +186,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
public void testDetachNoOverwrite() {
|
||||
OpenJPAEntityManager pm = getPM();
|
||||
AttachB b = (AttachB) pm.find(AttachB.class, oid);
|
||||
b = (AttachB) pm.detachCopy(b);
|
||||
b = (AttachB) pm.detach(b);
|
||||
endEm(pm);
|
||||
|
||||
b.setBstr("12");
|
||||
|
@ -216,7 +216,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
|
||||
assertNotNull("b is null in testOptimisticLock", b);
|
||||
|
||||
b = (AttachB) pm.detachCopy(b);
|
||||
b = (AttachB) pm.detach(b);
|
||||
endEm(pm);
|
||||
|
||||
b.setAint(12);
|
||||
|
@ -251,7 +251,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
assertNotNull("d is null in testEmbedded", d);
|
||||
|
||||
d.getEmbeddedE().getEstr();
|
||||
d = (AttachD) pm.detachCopy(d);
|
||||
d = (AttachD) pm.detach(d);
|
||||
endEm(pm);
|
||||
|
||||
d.getEmbeddedE().setEstr("E12");
|
||||
|
@ -280,7 +280,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
|
||||
assertNotNull("d is null in testNullEmbedded", d);
|
||||
d.getEmbeddedE().getEstr();
|
||||
d = (AttachD) pm.detachCopy(d);
|
||||
d = (AttachD) pm.detach(d);
|
||||
endEm(pm);
|
||||
|
||||
d.setEmbeddedE(null);
|
||||
|
@ -310,7 +310,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
assertNotNull("d is null in testNullEmbeddedRelated", d);
|
||||
|
||||
d.getEmbeddedE().getEstr();
|
||||
d = (AttachD) pm.detachCopy(d);
|
||||
d = (AttachD) pm.detach(d);
|
||||
endEm(pm);
|
||||
|
||||
d.getEmbeddedE().setEstr(null);
|
||||
|
@ -337,7 +337,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
OpenJPAEntityManager pm = getPM();
|
||||
AttachB b = (AttachB) pm.find(AttachB.class, oid);
|
||||
b.getDs();
|
||||
b = (AttachB) pm.detachCopy(b);
|
||||
b = (AttachB) pm.detach(b);
|
||||
endEm(pm);
|
||||
|
||||
assertEquals(1, b.getDs().size());
|
||||
|
@ -370,7 +370,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
|
||||
assertNotNull("b is null in doCollectionTest", b);
|
||||
b.getDs();
|
||||
b = (AttachB) pm.detachCopy(b);
|
||||
b = (AttachB) pm.detach(b);
|
||||
endEm(pm);
|
||||
|
||||
assertEquals("b is null in doCollectionTest", 1, b.getDs().size());
|
||||
|
@ -465,7 +465,7 @@ public class TestDetachedStateManager extends BaseKernelTest {
|
|||
pc.getRelSet();
|
||||
pc.getStringIntMap();
|
||||
if (!auto) {
|
||||
pc = (DetachSMPC) pm.detachCopy(pc);
|
||||
pc = (DetachSMPC) pm.detach(pc);
|
||||
assertDetachedSM(pc);
|
||||
}
|
||||
pc = (DetachSMPC) roundtrip(pc, false);
|
||||
|
|
|
@ -431,7 +431,7 @@ public class TestFetchPlan extends BaseKernelTest {
|
|||
PCCompany company1 =
|
||||
(PCCompany) pm.find(PCCompany.class, _rootCompanyId);
|
||||
|
||||
PCCompany company = (PCCompany) pm.detachCopy(company1);
|
||||
PCCompany company = (PCCompany) pm.detach(company1);
|
||||
assertTrue("company is equal company1", company != company1);
|
||||
Set departments = (Set) PCCompany.reflect(company, "departments");
|
||||
assertNotNull("department is null", departments);
|
||||
|
|
|
@ -224,7 +224,7 @@ public class TestOptimisticLockGroups extends BaseKernelTest {
|
|||
throws Exception {
|
||||
OpenJPAEntityManager pm1 = getPM(false, false);
|
||||
LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
|
||||
Object detached = pm1.detachCopy(pc1);
|
||||
Object detached = pm1.detach(pc1);
|
||||
startTx(pm1);
|
||||
pc1.setLockGroup0IntField(1);
|
||||
pc1.setUnlockedStringField("pm1 changed value");
|
||||
|
@ -259,7 +259,7 @@ public class TestOptimisticLockGroups extends BaseKernelTest {
|
|||
throws Exception {
|
||||
OpenJPAEntityManager pm1 = getPM(false, false);
|
||||
LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
|
||||
Object detached = pm1.detachCopy(pc1);
|
||||
Object detached = pm1.detach(pc1);
|
||||
startTx(pm1);
|
||||
pc1.setLockGroup0IntField(1);
|
||||
endTx(pm1);
|
||||
|
|
|
@ -187,7 +187,7 @@ public class TestPersistenceManagerFactoryImpl extends BaseKernelTest {
|
|||
public void testPlatform() {
|
||||
OpenJPAEntityManagerFactory pmf =
|
||||
(OpenJPAEntityManagerFactory) getEmf();
|
||||
assertNotNull(pmf.getProperties().get("Platform"));
|
||||
assertNotNull(pmf.getProperties().getProperty("Platform"));
|
||||
}
|
||||
|
||||
protected OpenJPAEntityManagerFactory getEmf(Map props) {
|
||||
|
|
|
@ -437,7 +437,7 @@ public class TestManagedInterfaces extends SingleEMFTestCase {
|
|||
|
||||
em = emf.createEntityManager();
|
||||
ManagedIface pcx = em.find(ManagedIface.class, oid);
|
||||
pc = em.detachCopy(pcx);
|
||||
pc = em.detach(pcx);
|
||||
em.close();
|
||||
|
||||
assertTrue(em.isDetached(pc));
|
||||
|
|
|
@ -301,8 +301,8 @@ public class TestValueStrategies
|
|||
endTx(pm);
|
||||
assertEquals(2, pc.getVersion());
|
||||
assertEquals(2, pc2.getVersion());
|
||||
ValueStrategyPC detached = (ValueStrategyPC) pm.detachCopy(pc);
|
||||
ValueStrategyPC detached2 = (ValueStrategyPC) pm.detachCopy(pc2);
|
||||
ValueStrategyPC detached = (ValueStrategyPC) pm.detach(pc);
|
||||
ValueStrategyPC detached2 = (ValueStrategyPC) pm.detach(pc2);
|
||||
endEm(pm);
|
||||
|
||||
// clean attach
|
||||
|
|
|
@ -79,7 +79,7 @@ public class TestLRS
|
|||
OpenJPAEntityManager em = emf.createEntityManager();
|
||||
LRSEntity lrs = em.find(LRSEntity.class, id);
|
||||
assertLRS(lrs, "lrs");
|
||||
lrs = em.detachCopy(lrs);
|
||||
lrs = em.detach(lrs);
|
||||
assertEquals("lrs", lrs.getName());
|
||||
assertNull(lrs.getLRSList());
|
||||
em.close();
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TestFlushBeforeDetach extends SQLListenerTestCase {
|
|||
|
||||
i.setItemData("EFGH");
|
||||
|
||||
OpenJPAPersistence.cast(em).detachCopy(i);
|
||||
OpenJPAPersistence.cast(em).detach(i);
|
||||
em.getTransaction().rollback();
|
||||
assertNotSQL("UPDATE ITEM SET.*");
|
||||
em.close();
|
||||
|
|
|
@ -97,17 +97,10 @@ public class EntityManagerFactoryImpl
|
|||
return _factory.getConfiguration();
|
||||
}
|
||||
|
||||
public Properties getPropertiesAsProperties() {
|
||||
public Properties getProperties() {
|
||||
return _factory.getProperties();
|
||||
}
|
||||
|
||||
public Map<String, Object> getProperties() {
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, Object> retv =
|
||||
new HashMap<String, Object>((Map) getPropertiesAsProperties());
|
||||
return retv;
|
||||
}
|
||||
|
||||
public Object putUserObject(Object key, Object val) {
|
||||
return _factory.putUserObject(key, val);
|
||||
}
|
||||
|
|
|
@ -748,7 +748,7 @@ public class EntityManagerImpl
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T detachCopy(T entity) {
|
||||
public <T> T detach(T entity) {
|
||||
assertNotCloseInvoked();
|
||||
return (T) _broker.detach(entity, this);
|
||||
}
|
||||
|
|
|
@ -535,12 +535,10 @@ public interface OpenJPAEntityManager
|
|||
/**
|
||||
* Detach the specified object from the entity manager.
|
||||
*
|
||||
* Note: renamed from detach to avoid conflict with JPA 2.0 EntityManager.detach method
|
||||
*
|
||||
* @param pc the instance to detach
|
||||
* @return the detached instance
|
||||
*/
|
||||
public <T> T detachCopy(T pc);
|
||||
public <T> T detach(T pc);
|
||||
|
||||
/**
|
||||
* Detach the specified objects from the entity manager.
|
||||
|
|
|
@ -33,18 +33,10 @@ import javax.persistence.EntityManagerFactory;
|
|||
public interface OpenJPAEntityManagerFactory
|
||||
extends EntityManagerFactory, Serializable {
|
||||
|
||||
/**
|
||||
* Return properties describing this runtime.
|
||||
* Although the name has changed, this method
|
||||
* returns the same type as the old getProperties method.
|
||||
*/
|
||||
public Properties getPropertiesAsProperties();
|
||||
|
||||
/**
|
||||
* Returns properties describing this runtime
|
||||
* using new signature to avoid conflict with JPA 2.0 API
|
||||
*/
|
||||
public Map<String, Object> getProperties();
|
||||
public Properties getProperties();
|
||||
|
||||
/**
|
||||
* Put the specified key-value pair into the map of user objects.
|
||||
|
|
|
@ -97,7 +97,7 @@ The extended
|
|||
explicitly detach objects at any time.
|
||||
</para>
|
||||
<programlisting>
|
||||
public Object detachCopy(Object pc):
|
||||
public Object detach(Object pc):
|
||||
public Object[] detachAll(Object... pcs):
|
||||
public Collection detachAll(Collection pcs):
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in New Issue