mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Improve error message throw on DTO unmapped DB column
This commit is contained in:
@@ -88,7 +88,7 @@ class DtoMeta {
|
||||
if (request.isRelaxedMode()) {
|
||||
property = DtoReadSetColumnSkip.INSTANCE;
|
||||
} else {
|
||||
throw new IllegalStateException("Unable to map DB column " + cols[i] + " to a property with a setter method on " + dtoType);
|
||||
throw new IllegalStateException(unableToMapColumnMessage(cols[i]));
|
||||
}
|
||||
}
|
||||
setterProps[pos++] = property;
|
||||
@@ -97,6 +97,10 @@ class DtoMeta {
|
||||
return new DtoQueryPlanConPlus(request, maxArgConstructor, setterProps);
|
||||
}
|
||||
|
||||
private String unableToMapColumnMessage(DtoColumn col) {
|
||||
return "Unable to map DB column " + col + " to a property with a setter method on " + dtoType+". Consider query.setRelaxedMode() to skip mapping this column.";
|
||||
}
|
||||
|
||||
private DtoQueryPlan matchSetters(DtoMappingRequest request) {
|
||||
|
||||
DtoColumn[] cols = request.getColumnMeta();
|
||||
@@ -110,7 +114,7 @@ class DtoMeta {
|
||||
if (request.isRelaxedMode()) {
|
||||
property = DtoReadSetColumnSkip.INSTANCE;
|
||||
} else {
|
||||
throw new IllegalStateException("Unable to map DB column " + cols[i] + " to a property with a setter method on " + dtoType);
|
||||
throw new IllegalStateException(unableToMapColumnMessage(cols[i]));
|
||||
}
|
||||
}
|
||||
setterProps[i] = property;
|
||||
|
||||
Reference in New Issue
Block a user