Skip to content

Tag: mapping

Unable to fetch Parent data from Child

I’m trying to see whether a Cab is assigned to any Employee so I can fetch that Employee Id and simply to set cab as null, but @OneToMany mapping, simply returning a list of Employees & by this I’m not getting any method like a cab.getEmp() to fetch employee details Employee.java Cab.java Cont…

MapStruct. Mapping fields of list element by expression

Good afternoon! There is an object that contains field as type List, is it possible to set each (some) field of type T, by values generated in the annotation by the expression parameter? For example: Target object: Mapper interface: How can such an idea be implemented? In the documentation, I found only examp…

Mapping to “” instead of null Jackson

I have a function that reads XML from a Kafka topic into String format, which I then want to convert to a JSON Object. Example XML: I then have POJO Classes such as: (with lombok getter/setter/toString and jackson annotation imports) I am then using a MappingJackson2XmlHttpMessageConverter to get an Object Ma…

Mapping multiple fields to one in Mapstruct?

I need to map from an open banking class to my core class. I am working with mapstruct. I need to map multiple enum fields to one on my core class. But i think mapstruct doesn’t support mapping multiple fields. Any tricky way or a solution for that? Thanks in advance! Here is my enum values from open ba…

String to JSONObject troubles

Is the first time I have to make this and I think I’m going to the wrong side. I trying to pass my String to a JSONObject but it’s nothing working. My code is this: The locationObj value after: (The code continue like a String and I don’t know why) The class I’m going to use to map lat…