Skip to main content

Questions tagged [mapstruct]

MapStruct is a code generator for creating efficient, type-safe bean-to-bean mappings in Java.

mapstruct
1 vote
1 answer
33 views

Hibernate SQL Error: NULL not allowed for column 'ID' on INSERT

I am encountering an issue with Hibernate when trying to insert a record into my database. Here are the details of the problem: Problem Description: I'm using Hibernate with Spring Boot to persist ...
m.wietecki's user avatar
0 votes
0 answers
16 views

How can i enforce a NotNull constraint in a uni-directional mapping in java with hibernate and mapstruct?

I have a parent class public class Parent { @Id @UuidGenerator @Column(name = "id", updatable = false, nullable = false) private UUID id; @CreationTimestamp @Column(...
Ben eriksson's user avatar
-1 votes
1 answer
51 views

List to set transformation seems to change order of elements

I am creating a certificate and I can specify the transit countries in it, they must be saved in the order in which they were set by the user. But under some circumstances, countries may be saved in ...
user25112351's user avatar
1 vote
1 answer
22 views

Set property without mapping in mapper Java Mapstruct

I have a mapper like: Cat toAnotherCat(Cat origin); And I need an another mapper like that (CatsHouse has a property: Cat oneOfCats;): CatsHouse toNewCatsHouse(CatsHouse catsHouse) When I run Maven ...
Akerke Kalibekova's user avatar
0 votes
0 answers
31 views

Dependency 'org.mapstruct:mapstruct:1.6.0.Beta2' not found

I have added the mapstruct dependency: <dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct</artifactId> <version>1.6.0.Beta2</version&...
LadyD's user avatar
  • 1
0 votes
0 answers
23 views

Mapstruct Mapper annotation "uses" attribute with example scenario

I am beginner working in startup. They gave me task to refactor mapper. Where I have 3 mappers. return 3 different DTOs. lets say block dto has 4 fields. foreign dto has 12 field where 4 are fields ...
Incognito Coder's user avatar
-1 votes
1 answer
40 views

How to unit test Mapper provided by MapStruct?

I want to unit test my MapStruct mappers, if that is a thing, should I use Mockito, or can I just call mapper = new UserMapperImpl();. UserMapperTest.java class UserMapperTest { private ...
Davido's user avatar
  • 95
0 votes
0 answers
35 views

Can mapstruct @SubclassMapping annotation be combined with an @Mapping for the subclass?

Using mapstruct v. 1.5.5, java v. 22. Let's say I have some entities that I am wanting to map to DTOs. The DTOs are java records. My base entity looks like this (simplified): public abstract class ...
Jermeel's user avatar
1 vote
0 answers
66 views

Qualifier error. No method found annotated with @Named#value Mapstruct update

@Mapping(target = "documentType", source = "dto.documentTypeId", qualifiedByName = "UpdateDocumentType") void update(@MappingTarget MyEntity entity, MyDTO dto); @Named(&...
Jake Morgan's user avatar
0 votes
1 answer
44 views

mapstruct, nested classes avoid writing mapper for each nested class

I have source and target classes that look like this class UserHistorySource { private DetailsSource details; } and class DetailsSource { private List<BalanceSource> balance; private ...
user641887's user avatar
  • 1,506
1 vote
1 answer
51 views

MapStruct not generating implementation

I am using Java 17,Gradle as build tool, the following is my gradle dependency implementation 'org.mapstruct:mapstruct:1.5.5.Final' implementation 'org.mapstruct:mapstruct-processor:1.5.5.Final' I ...
Ravi Teja's user avatar
1 vote
0 answers
163 views

Spring boot application not running in STS Boot Dashboard, but starts correctly with mvn spring-boot:run command

I have the following multi-module Maven project structure: iaas-cockpit (root project) │ ├── iaas-cockpit-backend (module) │ └── iaas-cockpit-core-lib (module) iaas-cockpit-backend is a Spring Boot ...
kalif_kay's user avatar
0 votes
0 answers
36 views

With MapStruct, every componentModel field option is read as Default

It's not important if I put cdi, jakarta or even spring. The compiler only read "default". I nead jakarta. @Mapper(componentModel = "jakarta-cdi") public interface DepartmentMapper ...
idronick's user avatar
0 votes
0 answers
23 views

Timezone mixing Hibernate, MapStruct, Spring

I'm getting frustrated with an issue that I want to resolve, but it's becoming very confusing. This is what I'm trying to achieve: Save dates in the database with timezone information. Input/Output in ...
Ixiodor's user avatar
  • 19
0 votes
0 answers
32 views

Why MapStruct dosen't return the modified list from @BeforeMapping as it should be

I am trying to map (using MapStruct) non null elements only from UserDTO list to Users list. It is true that toEntity(UserDTO userDTO) method checks null value but the created list for collection ...
Islam's user avatar
  • 17

15 30 50 per page
1
2 3 4 5
103