modelmapper Questions

7

Solved

I am getting data from my form through a DTO and mapping it to my Hibernate entity. I wanted to skip a date field as the incoming data is all strings and I need to convert the string field into a d...
Unmeant asked 20/6, 2016 at 6:49

4

Solved

I'm refactoring my code. I want to use java records instead of java class in my DTO. To convert DTO to Entity, I'm using ModelMapper (version 2.3.5). When I try to get info about user (call method ...
Mozzetta asked 18/6, 2020 at 17:7

3

Solved

I'm having list of employee objects - List I need to convert it into list of employee transfer objects - List Assume a field "password" exist in both the classes. In few cases i need the passwor...
Michaud asked 8/6, 2016 at 9:28

6

I cannot resolve modelMapper error. Do you have any ideas where is the issue? NB: In view java.sql.Time doesn't have non-argument constructor I didn't find the better way than to write converter ...
Declamation asked 14/4, 2018 at 13:4

4

Solved

TL;DR I want to use modelMapper in a way that I map from AbstractParent to AbstractParentDTO and later in the ModelMapper-Config call the specific mappers for each Sub-class and then skip the rest...
Aesir asked 24/9, 2018 at 8:32

2

Here is the class of the object I am trying to map: package com.agent.module.entities; import java.util.Set; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.pe...
Ripsaw asked 13/5, 2018 at 18:49

14

I want to convert/map some "data" class objects to similar "data" class objects. For example, classes for web form to classes for database records. data class PersonForm( val firstName: String, ...
Yahrzeit asked 29/8, 2016 at 6:1

5

Solved

I want to use ModelMapper to convert entity to DTO and back. Mostly it works, but how do I customize it. It has has so many options that it's hard to figure out where to start. What's best practice...
Krantz asked 14/6, 2017 at 1:54

4

Solved

I'm working with mongodb so I'm decoupling entities from presentation layer creating DTOs (with hibernate-validator annotations). public abstract class UserDTO { private String id; @NotNull p...
Minivet asked 2/3, 2017 at 9:19

2

Solved

How to map/merge multiple fields into one field? Like concatenate a firstname and lastname to the destination fullname? public class ModelMapperConfigTest { @Test public void should_validate() ...
Parachute asked 15/11, 2017 at 0:49

3

A.java @Entity @Getter @Setter @Inheritance @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, inclue=JsonTypeInfo.As.PROPERTY, property="type") @JsonSubTypes({ @JsonSubTypes.Type(value=AA.class,name="aa")...
Andros asked 19/5, 2018 at 10:6

2

Solved

I have two classes that use ModelMapper to convert entity to DTO. In each class I have a configuration in class's constructor to ModelMapper, to avoid convert all the relations into DTO and get Sta...
Erasure asked 16/12, 2020 at 19:45

1

As in clean architecture, we have to define the Entities in Domain layer and Models in Data layer. Now the issue that i am facing is in converting the entities into models when we are passing that ...
Krick asked 4/8, 2021 at 13:34

1

Dependency used in Gradle: compile group: 'org.modelmapper', name: 'modelmapper', version: '2.3.8' Code Currently I have: modelMapper = new ModelMapper(); modelMapper.getConfiguration() .setMatc...
Pulsimeter asked 3/9, 2020 at 6:42

1

Solved

Model We use org.modelmapper for our bean mapping. Here is the data model (using public for brevity): class Root { public String foo; public List<Element> elements; } class Element { publi...
Utricle asked 16/9, 2021 at 21:7

3

Modelmapper is giving LazyInitializationException while converting from entity to dto. Is there any way i can disable this. If am calling modelmapper.map inside transaction block it is working fin...
Frowzy asked 22/6, 2019 at 13:8

5

I'm trying to map a Java DTO object to an existing JPA entity object without having to do something like the following: public MyEntity mapToMyEntity(SomeDTO dto, MyEntity entity) { entity.setFie...
Ranita asked 3/10, 2017 at 1:48

5

This question is not relating with AutoMapper. My question is about ModelMapper in java, however I cannot create new tag for modelmapper as my little reputation. Sorry for confusion. Anyway, my qu...
Weinstock asked 26/8, 2011 at 4:5

1

Solved

I have two classes say Animal & AnimalDto I want to use ModelMapper to convert Entity to DTO and vice verca. But the classes are supposed to have different data types for a few attributes havin...
Replicate asked 30/10, 2020 at 8:21

2

I can't find any explanation about difference between jackson's ObjectMapper to other mappers like dozer/mapStruct/modelMapping/etc. All the articles compare dozer/mapStruct/modelMapping but they i...
Latium asked 26/8, 2020 at 14:58

3

Solved

I would like to map between UserDTO and User, but excluding one field, say city. How can I do that, cause I though that this approach would work, but it doesn't: ModelMapper modelMapper = new Mode...
Malapert asked 2/3, 2018 at 17:57

3

Solved

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) containing abstract classes. Ex...
Gelasius asked 23/1, 2015 at 14:17

3

Solved

I want to do a partial update on one of my entities but if one propertie is null then the entity to be updated gets that value set to null too. I want that if a property from the source is null the...
Deathblow asked 29/5, 2019 at 11:21

3

Class A { private String a; private String b; private B innerObject; } Class B { private String c; } In my case, String b might come in with a null value. My modelmapper configuration is like...
Fleam asked 14/12, 2017 at 17:14

2

Solved

I learn how to use ModelMapper by official documentation http://modelmapper.org/getting-started/ There is code sample for explicit mapping using java 8 modelMapper.addMappings(mapper -> { map...
Gratifying asked 27/2, 2018 at 8:8

© 2022 - 2024 — McMap. All rights reserved.