use of org.eclipse.persistence.exceptions.EclipseLinkException in project eclipselink by eclipse-ee4j.
the class UnitOfWorkImpl method validateObjectSpace.
/**
* ADVANCED:
* This can be used to help debugging an object-space corruption.
* An object-space corruption is when your application has incorrectly related a clone to an original object.
* This method will validate that all registered objects are in a correct state and throw
* an error if not, it will contain the full stack of object references in the error message.
* If you call this method after each register or change you perform it will pin-point where the error was made.
*/
@Override
public void validateObjectSpace() {
log(SessionLog.FINER, SessionLog.TRANSACTION, "validate_object_space");
// This define an inner class for process the iteration operation, don't be scared, its just an inner class.
DescriptorIterator iterator = new DescriptorIterator() {
@Override
public void iterate(Object object) {
try {
if (isClassReadOnly(object.getClass(), getCurrentDescriptor())) {
setShouldBreak(true);
return;
} else {
getBackupClone(object, getCurrentDescriptor());
}
} catch (EclipseLinkException exception) {
log(SessionLog.FINEST, SessionLog.TRANSACTION, "stack_of_visited_objects_that_refer_to_the_corrupt_object", getVisitedStack());
log(SessionLog.FINER, SessionLog.TRANSACTION, "corrupt_object_referenced_through_mapping", getCurrentMapping());
throw exception;
}
}
};
iterator.setSession(this);
for (Iterator clonesEnum = getCloneMapping().keySet().iterator(); clonesEnum.hasNext(); ) {
iterator.startIterationOn(clonesEnum.next());
}
}
use of org.eclipse.persistence.exceptions.EclipseLinkException in project eclipselink by eclipse-ee4j.
the class BidirectionWithHashtableTest method test.
@Override
public void test() {
try {
getSession().setIntegrityChecker(new IntegrityChecker());
getSession().getIntegrityChecker().dontCatchExceptions();
((DatabaseSession) getSession()).addDescriptor(descriptor());
} catch (EclipseLinkException exception) {
caughtException = exception;
}
}
use of org.eclipse.persistence.exceptions.EclipseLinkException in project eclipselink by eclipse-ee4j.
the class ForeignKeysDefinedIncorrectlyTest method test.
@Override
public void test() {
try {
getSession().setIntegrityChecker(new IntegrityChecker());
getSession().getIntegrityChecker().dontCatchExceptions();
((DatabaseSession) getSession()).addDescriptor(descriptor());
} catch (EclipseLinkException exception) {
caughtException = exception;
}
}
use of org.eclipse.persistence.exceptions.EclipseLinkException in project eclipselink by eclipse-ee4j.
the class GetMethodReturnsValueHolderTest method test.
@Override
public void test() {
try {
getSession().setIntegrityChecker(new IntegrityChecker());
getSession().getIntegrityChecker().dontCatchExceptions();
((DatabaseSession) getSession()).addDescriptor(descriptor());
} catch (EclipseLinkException exception) {
caughtException = exception;
}
}
use of org.eclipse.persistence.exceptions.EclipseLinkException in project eclipselink by eclipse-ee4j.
the class IllegalArgumentWhileGettingValueThruInstanceVariableAccessorTest method test.
@Override
public void test() {
org.eclipse.persistence.testing.tests.validation.PersonInstanceAccess person = new org.eclipse.persistence.testing.tests.validation.PersonInstanceAccess();
person.setName("Person");
Address address = new Address();
try {
getSession().setIntegrityChecker(new IntegrityChecker());
getSession().getIntegrityChecker().dontCatchExceptions();
((DatabaseSession) getSession()).addDescriptor(descriptor());
UnitOfWork uow = getSession().acquireUnitOfWork();
uow.registerObject(person);
uow.commit();
DatabaseMapping dMapping = descriptor().getMappingForAttributeName("p_name");
DatabaseMapping idMapping = descriptor().getMappingForAttributeName("p_id");
dMapping.getAttributeAccessor().initializeAttributes(org.eclipse.persistence.testing.tests.validation.PersonInstanceAccess.class);
dMapping.getAttributeAccessor().initializeAttributes(org.eclipse.persistence.testing.tests.validation.PersonInstanceAccess.class);
dMapping.getAttributeValueFromObject(address);
} catch (EclipseLinkException exception) {
caughtException = exception;
}
}
Aggregations