after reading articles on hexagonal architecture, i decided to implement these practices. only i'm stuck in one place, i'd like to know how to map domain objects into domain entities. here is what i tried
//jpa entity
@Entity
@Data
public class Worker {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private String phoneNumber;
private String firstName;
private String lastName;
private String workerType;
private String ifu;
private String workerPicture;
private String statut;
@OneToMany(mappedBy = "worker")
Set<CategoryWorker> category;
}
// domain model
public class Worker {
private Long id;
private String phoneNumber;
private String firstName;
private String lastName;
private String workerType;
private String ifu;
private String imageParth;
private String statut;
}
// port out
public interface ListOfWorkerRepository {
public List<Worker> findAll();
}
// port in
public interface ListOfWorker {
public List<Worker> findAll();
}
// adapters out
public class ListWorkerImpl implements ListOfWorkerRepository{
WorkerJpaInterface workerJpaInterface;
@Override
public List<Worker> findAll() {
return workerJpaInterface.findAll();
}
}
// here I have an conversion error