Supports loading of corrupt beans

This commit is contained in:
Roland Praml committed 2019-01-03 11:43:50 +01:00
1 parent 0b299edf0d
commit 4d93b70bf9
26 files changed
+221 -24

No files matched your search

@@ -90,4 +90,10 @@ public interface DbReadContext {
* Return true if this request disables lazy loading.
*/
boolean isDisableLazyLoading();
/**
* Handles a load error on given property.
*/
void handleLoadError(EntityBean bean, BeanProperty prop, String fullName, Exception e);
}
@@ -49,15 +49,16 @@ class DynamicPropertyAggregationFormula extends DynamicPropertyBase {
@Override
public void load(SqlBeanLoad sqlBeanLoad) {
Object value;
try {
Object value = scalarType.read(sqlBeanLoad.ctx().getDataReader());
if (asTarget != null) {
sqlBeanLoad.load(asTarget, value);
}
value = scalarType.read(sqlBeanLoad.ctx().getDataReader());
} catch (Exception e) {
throw new PersistenceException("Error loading on " + fullName, e);
sqlBeanLoad.ctx().handleLoadError(null, asTarget, fullName, e);
return;
}
if (asTarget != null) {
sqlBeanLoad.load(asTarget, value);
}
}