use of org.datanucleus.FetchPlanState in project datanucleus-api-jdo by datanucleus.
the class JDOPersistenceManager method makeTransient.
/**
* Method to make transient an object allowing fetching using the fetch plan.
* @param pc The object
* @param useFetchPlan Whether to make transient all objects in the fetch plan
*/
public void makeTransient(Object pc, boolean useFetchPlan) {
assertIsOpen();
FetchPlanState state = null;
if (useFetchPlan) {
// Create a state object to carry the processing state info
state = new FetchPlanState();
}
jdoMakeTransient(pc, state);
}
use of org.datanucleus.FetchPlanState in project datanucleus-api-jdo by datanucleus.
the class JDOPersistenceManager method detachCopyAll.
/**
* Detach the specified objects from the <code>PersistenceManager</code>.
* @param pcs the instances to detach
* @return the detached instances
* @see #detachCopyAll(Object[])
*/
public <T> Collection<T> detachCopyAll(Collection<T> pcs) {
assertIsOpen();
assertReadable("detachCopyAll");
// Detach the objects
FetchPlanState state = new DetachState(ec.getApiAdapter());
List detacheds = new ArrayList();
for (T pc : pcs) {
if (pc == null) {
detacheds.add(null);
} else {
detacheds.add(jdoDetachCopy(pc, state));
}
}
return detacheds;
}
use of org.datanucleus.FetchPlanState in project datanucleus-api-jdo by datanucleus.
the class JDOPersistenceManager method makeTransientAll.
/**
* Method to make transient a collection of objects.
* @param pcs The objects
* @param useFetchPlan Whether to use the fetch plan when making transient
* @throws JDOUserException thrown if objects could not be made transient.
*/
public void makeTransientAll(Collection pcs, boolean useFetchPlan) {
assertIsOpen();
ArrayList failures = new ArrayList();
Iterator i = pcs.iterator();
FetchPlanState state = null;
if (useFetchPlan) {
// Create a state object to carry the processing state info
state = new FetchPlanState();
}
while (i.hasNext()) {
try {
jdoMakeTransient(i.next(), state);
} catch (RuntimeException e) {
failures.add(e);
}
}
if (!failures.isEmpty()) {
throw new JDOUserException(Localiser.msg("010041"), (Exception[]) failures.toArray(new Exception[failures.size()]));
}
}
Aggregations