Hi,
I want to know if Spring Data JPA supports the following:
I have 2 classes representing the same object, lets call them A and AEntity
A is the domain object i use in my application, but it contains some fields which are not saveable without conversion.
AEntity is the JPA annotated class which can be saved.
I can convert them both ways.
Is there a way to use a ConversionService to do the conversion automatically without me implementing my own CrudRepository with methods like:
I want to know if Spring Data JPA supports the following:
I have 2 classes representing the same object, lets call them A and AEntity
A is the domain object i use in my application, but it contains some fields which are not saveable without conversion.
AEntity is the JPA annotated class which can be saved.
I can convert them both ways.
Is there a way to use a ConversionService to do the conversion automatically without me implementing my own CrudRepository with methods like:
Code:
public A save(A a){
AEntity entity= conversionService.convert(a);
entityRepository.save(entity);
a.setId(entity.getId());
return a;
}