I have a spring-data-jpa application and a library. The library contains a class, lets say Car.java
public class Car{
Long id;
String name;
String color;
.. getter and setter
}
In my application I need to store this object and want to use rest repositories. For that I need to annotate the class:
@Entity
@Table(name = "customerCar")
public class CarEntity{
@Id
Long id;
String name;
String color;
.. getter and setter
}
Is there a way to do this without code duplication and/or without make a copy?
CarEntity customerCar = new CarEntity();
customerCar.setId(car.getId());
....