Merge branch 'feature/load-error' of https://github.com/FOCONIS/ebean into FOCONIS-feature/load-error

This commit is contained in:
rob bygrave committed 2019-01-09 19:25:50 +13:00
commit fb5eb0cdd2
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);
}
}