My entity is return fields null example: EntityTest{id=null, name=null}
but I need that if all fields are null return EntityTest = null
TestEntity
@Entity
@Table(name="TestEntity")
public class TestEntity {
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name="test_name")
private String testName;
}
TestEntityDto
public class TestEntityDto {
private long id;
private String test_name;
}
TestEntityMapper
@Mapper
public interface TestEntityMapper {
TestEntity TestEntityDTOToTestEntity(TestEntityDTO testEntityDTO);
Implementa
testEntityDTO.setId(null);
testEntityDTO.setNameTest(null);
TestEntity testEntity = TestEntityMapper.TestEntityDTOToTestEntity(testEntityDTO);
Actual Result:
EntityTest{id=null, name=null}
Expected Result:
EntityTest = null