ModelMapper: mapping abstract classes during runtime

后端 未结 3 662
南旧
南旧 2020-12-19 08:31

I am using ModelMapper Framework (http://modelmapper.org/) for mapping objects in Java. I have encountered a problem while mapping concrete classes (DTO to Entites) containi

3条回答
  •  北海茫月
    2020-12-19 09:17

    I couldn't solve this problem with ModelMapper. Thus, I switched over to Dozer.
    Dozer is a great tool for object mapping in Java. And it is really easy to use as well. You can define the corresponding mapping classes in a XML-file.

    Here's a link to the documentation. http://dozer.sourceforge.net/documentation/mappings.html

    My Solution with Spring
    dozer-bean.xml

    
            
                
                    META-INF/mapping/dozer-config.xml
                
            
    
    

    dozer-config.xml

    
                com.packagename.dto.QuestionDTO
                com.packagename.entities.core.Question
    
    
            com.packagename.dto.CriteriaDTO
            com.packagename.entities.core.Criteria
    
    

提交回复
热议问题