Search in sources :

Example 1 with MappingClassCastException

use of org.dbflute.exception.MappingClassCastException in project dbflute-core by dbflute.

the class TnRowCreatorExtension method throwMappingClassCastException.

protected void throwMappingClassCastException(Object entity, DBMeta dbmeta, TnPropertyMapping mapping, Object selectedValue, ClassCastException e) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Failed to cast a class while data mapping.");
    br.addItem("Advice");
    br.addElement("If you use Seasar(S2Container), this exception may be");
    br.addElement("from ClassLoader Headache about HotDeploy.");
    br.addElement("Add the ignore-package setting to convention.dicon like this:");
    br.addElement("    <initMethod name=”addIgnorePackageName”>");
    br.addElement("        <arg>”com.example.xxx.dbflute”</arg>");
    br.addElement("    </initMethod>");
    br.addElement("If you use an other DI container, this exception may be");
    br.addElement("from illegal state about your settings of DBFlute.");
    br.addElement("Confirm your settings: for example, typeMappingMap.dfprop.");
    br.addItem("Exception Message");
    br.addElement(e.getMessage());
    br.addItem("Target Entity");
    br.addElement(entity);
    br.addElement("classLoader: " + entity.getClass().getClassLoader());
    br.addItem("Target DBMeta");
    br.addElement(dbmeta);
    br.addElement("classLoader: " + dbmeta.getClass().getClassLoader());
    br.addItem("Property Mapping");
    br.addElement(mapping);
    br.addElement("type: " + (mapping != null ? mapping.getClass() : null));
    br.addItem("Selected Value");
    br.addElement(selectedValue);
    br.addElement("type: " + (selectedValue != null ? selectedValue.getClass() : null));
    final String msg = br.buildExceptionMessage();
    throw new MappingClassCastException(msg, e);
}
Also used : MappingClassCastException(org.dbflute.exception.MappingClassCastException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder)

Aggregations

MappingClassCastException (org.dbflute.exception.MappingClassCastException)1 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1